0

As root run:

cd /tmp
seq 10 > foo
chmod 666 foo
seq 10 >> foo
chown daemon foo
seq 10 >> foo

This gives:

-bash: foo: Permission denied

It is clear that it is due to /tmp's special permission (drwxrwxrwt), because it works fine in /tmp/bardir.

But why? Should the group ownership and permission not allow root to append to the file?

$ ls -l foo
-rw-rw-rw- 1 daemon root 42 Dec  6 09:11 foo
$ lsattr foo
-------------------- foo
$ ls -ld /tmp
drwxrwxrwt 34 root root 137 Dec  6 09:11 /tmp
$ lsattr -d /tmp
-------------------- /tmp
3
  • Is SELinux enabled? Dec 6, 2020 at 8:28
  • @NasirRiley Not that I know of. It is a normal Ubuntu 20.04, and I have not actively installed SELinux.
    – Ole Tange
    Dec 6, 2020 at 8:39
  • 1
    The behavior has been changed in Ubuntu 20.04. The same doesn't occur in Debian 10 (Buster) or CentOS 8.2. To set it back to what it was in Ubuntu 18.04, use this answer: askubuntu.com/questions/1250974/… Dec 6, 2020 at 9:09

0

Browse other questions tagged .