In Ubuntu 18.04, I can create a file as one user in /tmp
, and write to it as user root
(despite the sticky bit being set on /tmp
).
In Ubuntu 20.04, I get a Permission Denied
error as user root
.
Ubuntu 18.04:
# As user "ubuntu":
touch /tmp/tmplock
# As user "root":
echo "foo" > /tmp/tmplock
cat /tmp/tmplock
# Outputs "foo"
ls -lah /tmp
drwxrwxrwt 32 root root 20K Jun 16 18:36 .
-rw-rw-r-- 1 ubuntu ubuntu 4 Jun 16 18:36 tmplock
Ubuntu 20.04:
# As user "ubuntu":
touch /tmp/tmplock
# As user "root":
echo "foo" > /tmp/tmplock
# Outputs: bash: /tmp/tmplock: Permission denied
ls -lah /tmp
drwxrwxrwt 12 root root 4.0K Jun 16 18:15 .
-rw-rw-r-- 1 ubuntu ubuntu 0 Jun 16 18:14 tmplock
I can't find any information on if this is related to the sticky bit, or an underlying Linux kernel change, or anything.
Does anyone know what can explain the change in behavior?