I create a file as regular user testuser:
$ cat > /tmp/zz the file is owned by that user (as expected):
$ ls -lA /tmp/zz -rw------- 1 testuser testuser 0 Feb 20 15:32 zz Now when I try to truncate it as root, I get permission denied:
# truncate --size=0 /tmp/zz truncate: cannot open '/tmp/zz' for writing: Permission denied When I try with strace, I see the following:
openat(AT_FDCWD, "/tmp/zz", O_WRONLY|O_CREAT|O_NONBLOCK, 0666) = -1 EACCES (Permission denied) write(2, "truncate: ", 10truncate: ) = 10 write(2, "cannot open '/tmp/zz' for writin"..., 33cannot open '/tmp/zz' for writing) = 33 ... write(2, ": Permission denied", 19: Permission denied) = 19 write(2, "\n", 1 Why does root not have permissions to write to that file? Root can delete the file, but not write.