Monday, September 24, 2012

Changing the default user and group for files in linux directories

Issue this command to have new files in the directory get set with the owner the same as the owner of the directory

chmod u+s

or issue this command to have new files in the directory get set with the group that is the same as the group of the directory

chmod g+s

also restricting deletion by any non-owner or privileged user is chmod +t to set the sticky bit

Capitalization is used to show whether the execute permission is set or not since these settings show up in the same spaces as the execute bit.

Here are a few examples that you might see if you ls -la:

rwSrwSrwT
(that means rwxrwxrwx with uid, gid, & sticky set)

rwxrwSrwt
(that means rwxrwxrw- with only the gid & sticky set)

Followers