Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extract a tar while ignoring permissions

I am transferring a tar file between two servers and extracting when it is received. The issue I am having is that the permissions are being retained and applied on the target server causing permission issues.

Is there a way to extract a tar file with ignoring the original permissions of the files it is extracting.

like image 375
Christopher Shaw Avatar asked Jun 21 '18 08:06

Christopher Shaw


2 Answers

--no-same-permissions seems to "and" the umask, so even less permissions then in the tar.

like image 60
jkl Avatar answered Oct 23 '22 12:10

jkl


The default options for tar command on CentOS-7.2 includes --no-same-permissions

The output from tar manual includes the following:

--no-same-permissions
 apply the user's umask when extracting permissions from the archive (default for ordinary users)
like image 32
coredump Avatar answered Oct 23 '22 11:10

coredump