If you're running tar(1)
as a regular user, it will apply your umask
by default. If you're running tar(1)
as root
, then you can give --no-same-permissions
command line option to ask tar(1)
to respect the umask
.
So: either run this as a regular user:
umask 022
tar zxvf file.tar.gz
or run this as root
:
umask 022
tar zxvf file.tar.gz --no-same-permissions
You might want to stick umask 022
into your ~/.bashrc
, ~/.bash_profile
, or ~/.profile
. (See bash(1)
manpage for full details on the start up files. It's complicated.)
Details on umask
can be found in your shell's manpage, the umask(2)
system-call manpage, or the umask(1posix)
POSIX-provided utility manpage (if you have the manpages-posix
installed).
There is a website called "Command Line Fu" that has lots of other ideas also. – djangofan – 2012-01-30T01:45:36.933