File system permissions allow you to dictate who can see, read and write your files. This is very useful when you want to restrict people from doing this that they should not be allowed. File permissions have such structure:drwxrwxrwx1
d - means that it is a directory
rwx stands for read, write and execute

You can set permissions for different type of users

  • drwx------ - For the owner of the file
  • d---rwx--- - for people that this file is shared with
  • d------rwx - for everyone

How to set or change permissions

To be able to set or change permissions, you have to use command chmod which stands for change mode. 2

The syntax is as follows chmod -R u=rwx, g=rwx, o=rwx {file/directory name}
u stands for user
g stands for group
o stands for others

Changing owner

Sometimes, you might want to change the owner of the file. To be able to do that, you can use chown command which stands for change owner.

sudo chown -R root {directory/file}

Footnotes

  1. Terminal Course > Permissions

  2. Terminal Course > Permissions