Managing File System Permissions From The Command Line: Changing File and Directory User or Group Ownership
Managing File System Permissions From The Command Line: Changing File and Directory User or Group Ownership
Command Line
The chmod command supports the -R option to recursively set permissions on the files in an
entire directory tree. When using the -R option, it can be useful to set permissions
symbolically using the X option.
chmod go-rw file1 Remove read and write permission for group and other on file1:
chmod 644 samplefile Set read and write permissions for user, read permission for
group and other, on samplefile
The chown command can also be used to change group ownership of a file by preceding the
group name with a colon (:). For example, the following command changes the group
test_dir to admins:
The chown command can also be used to change both owner and group at the same time by
using the owner:group syntax. For example, to change the ownership of test_dir to
visitor and the group to guests, use the following command:
Use the echo command to change the default umask for the operator1 user to 007.
u+s
File executes as the user that
(suid) owns the file, not the user No effect.
that ran the file.
g+s File executes as the group Files newly created in the directory have their group
(sgid) that owns the file. owner set to match the group owner of the directory.
o+t
Users with write access to the directory can only
(sticky) No effect. remove files that they own; they cannot remove or
force saves to files owned by other users.