File permission with chmod
The chmod command is used to give and set file permissions
Syntax
Chmod [permissions] filenames
Permissions: Specifies what rights are you granting
Filenames: File or directory to which you are assigning the permissions.
When you start granting permissions, you might opt for any of the following options: letters or numerical (I prefer numerical).
Permissions that you can grant:
By letter | Numerical | ||
U | User who owns the file | 400 | Read by owner |
g | group that owns the file | 040 | Read by group |
o | Other | 004 | Read by others |
a | All | 200 | Write by owner |
r | Readable file | 020 | Write by group |
w | Writeable file | 002 | Write by others |
x | Executable file | 100 | Execute by owner |
| | 010 | Execute by group |
| | 001 | Execute by others |
There is something else that we need to understand before we can actually give permissions. First we have to know what type of permissions we are granting, and to whom it will be granted.
User IDS and Group IDS UID/GID
Under the UNIX operating system, every user is member of a group by default when you create a new user that user is member of its own group or member of users. The administrator can make specific users be part of any other group. Keep in mind that when the system executes or does something under a user name, that system does not actually see that user name, instead it sees just a user ID.
- user ID stands as a number
- A user name stands as a string and it is associated to the ID number
This is exactly the same for groups:
- A group ID is a number
- A group name is a string associated to the group ID number.
No comments:
Post a Comment