tar changing permissions on /tmp?

I ran into something that surprised me, maybe its common knowledge to
some but this one caught me off guard.

On one of my systems, a lot of processes started failing because they
couldnt write to /tmp.
Checking the permissions, it was indeed incorrect. The sticky bit was
not set and the perms were dr-xr-xr-x

After scratching my head a bit trying to figure out how this got
changed, I recalled that not very long before this I untarred a file
into /tmp. Based on that suspicion, I created a new directory in /tmp
(so I wouldnt break things again), made the perms. the same as tmp
(with sticky bit) moved the suspect tar file there and untarred.

Sure enough, once the tar commend finished, it changed the permissions
back to dr-xr-xr-x

I am sure tar is behaving the way it is supposed to behave but I have
never run into this before, and as you can see changing the permissions
on /tmp can break a *lot* of things...any ideas what I need to watch
out for so this doesnt happen again?


Relevant Pages

  • Re: R: Linux kernel source archive vulnerable
    ... those are actually the permissions we want in the tar archive. ... I seem to recall the UNIX way to do that is umask which works perfectly with tar as a normal user and kernel tarballs. ... Should they get UID 0 because I have chown permissions and the author of the tar archive was tarring as root? ...
  • Re: Setting permissions for SFTP transfer (during transfer, not after)
    ... the permissions from when it first exists. ... To specify the requirement ... i.e. tar the file on the remote end, transfer over ssh and untar on the ... Tar preserves permissions ...
  • Re: Copy a directory tree WITH preserving owner and flags ?
    ... As far as I know the standard copy command overwrites e.g. the owner ... of the copied directory tree with "root" (resp. ... they will retain their original ownership and permissions. ... Tar will do this. ...
  • Re: R: Linux kernel source archive vulnerable
    ... The Linux kernel tar archive contains files with world-writeable ... permissions. ... This began in early git history. ...