How permissions work on files and directories
·1 min
Table of Contents
List set and change standard permissions #
chgrp - change group
Change group ownerships
chmod - change mode
Change modification permissions
chown - change ownership
Change ownerships of users
When we do ls -l
we get this:
$ drwxr-xr-x user family 4.0 KB Thu Nov 10 07:31:07 2022 Downloads
Interpretation: Here we see the folder “Downloads” is owned by user “user” which has the read / write permissions to it and the super user “sudo” too which has the admin privelages not to mention. Other than the user their is also a family attribiute next to it which is a group which can be seen having two permissions of reading it and executing it.
Changing the group of the file it belongs to we can use the command chgrp
: #
$ chgrp wheel file
Output:
$ drwxr-xr-x user wheel 4.0 KB Thu Nov 10 07:31:07 2022 Downloads
To see which a current user belongs to we can use: #
$ groups
Output:
$ someuser adm cdrom sudo dip plugdev lpadmin lxd sambashare
Changing owenership of file/directory we use chown
: #
$ sudo chown user filename