Sample Header Ad - 728x90

Sticky bit doesn't allow to delete or rename a file within a directory

0 votes
1 answer
69 views
As shown below, on my Ubuntu system, carlo directory has the sticky bit permission set. It contains the file file1 owned by user lab.
-shellsession
lab@ubuntu:~$ ll | grep carlo
drwxrwxr-t  2 ubuntu ubuntu  4096 Oct 31 08:09 carlo/

lab@ubuntu:~$ ll /home/ubuntu/carlo/file1 
-rw-rw-r-- 1 lab ubuntu 0 Oct 31 08:09 /home/ubuntu/carlo/file1
lab@ubuntu:~$
As you can see user lab owns file1, yet he can't rename or delete the file.
-shellsession
lab@ubuntu:~$ mv /home/ubuntu/carlo/file1 /home/ubuntu/carlo/file2
mv: cannot move '/home/ubuntu/carlo/file1' to '/home/ubuntu/carlo/file2': Permission denied

lab@ubuntu:~$ rm /home/ubuntu/carlo/file1
rm: cannot remove '/home/ubuntu/carlo/file1': Permission denied
lab@ubuntu:~$
Is this an expected behavior?
Asked by CarloC (385 rep)
Oct 31, 2024, 01:24 PM
Last activity: Oct 31, 2024, 03:19 PM