Skip to content

Instantly share code, notes, and snippets.

@MKo-xx
Created March 31, 2011 15:13
Show Gist options
  • Select an option

  • Save MKo-xx/896536 to your computer and use it in GitHub Desktop.

Select an option

Save MKo-xx/896536 to your computer and use it in GitHub Desktop.
$ mkdir tmp
$ sudo chown root:root tmp # change owner to root
$ sudo chmod o+w tmp # add permission to other user to add files
$
$ sudo mkdir tmp/123 # create a directory owned by root
$ sudo chmod 777 tmp/123 # give all permissions, so other user can remove it.
$ rm -r tmp/123 # remove it without any problem.
$
$ sudo mkdir tmp/123 # create a directory owned by root again
$ sudo chmod 777 tmp/123 # give all permissions, so other user can remove it.
$ sudo chmod +t tmp # set on sticky bit
$ rm -r tmp/123/ # try to remove it.
rm: cannot remove `tmp/123': Operation not permitted
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment