System & Network Permissions
Linux is a system in which each person who is waiting to connect must have a user name and password. Each file belongs to a user and a group has different permissions (read, write, execute) for users, groups and everyone. By default, when you create a file it automatically belongs to the user and his group. Users are stored in the file / etc / passwd. We can add a user using the adduser command. Similarly, you can delete a user with deluser order. The groups are defined in the / etc / group file and used to define groups of users to define their scope.
Some permissions:
– The “r” read (read)
– Writing “w” (write)
– The execution “x” (execution)
– Writing “w” (write)
– The execution “x” (execution)
These three states are given in the following order:
– The owner “u” (user)
– Users Group “g” (group)
– All other “o” (other) (that is to say, other users)
– Users Group “g” (group)
– All other “o” (other) (that is to say, other users)
Let’s take a small example:
$ Ls-l file
Rwxrw–r – 1 user user 249 Jun 2 7:42 p.m. file
Rwxrw–r – 1 user user 249 Jun 2 7:42 p.m. file
Here, the first indent indicates if file is a file or directory.
If file was a directory, then we would have:
drwxrw-r – 1 user user 249 Jun 2 7:42 p.m. file
The first showing directories “d”. We also have an “l” for a link, etc. Then three groups of three characters corresponding to the user, group and all other users. The letters r, w and x indicates that the file permissions and a dash indicates that he did not. In the previous example, file is read, write and execute (rwx) for the user to read, write (rw) for the group and just read (r -) for all others.
#chmod
We can change the permissions of a file or directory using two notations:
We can change the permissions of a file or directory using two notations:
symbolic form:
rwx rx r -
user group other
“U” “g” “o”
rwx rx r -
user group other
“U” “g” “o”
digital form in octal (base 8):
rwx rw-r -
421420400
7 6 4
rwx rw-r -
421420400
7 6 4
In digital form, the read permission is set to 4, the writing is set to 2 and run 1. Then, using chmod, just additional for each section (user, group and others) the values you want to assign. In the previous example, rwx rw-r – gives us 764. rwx -> 4 +2 +1 = 7, rw -> 4 +2 = 6 and r -> 4. Now try to change permissions using the chmod command. For example:
$ Chmod 0744 file
is rwx r – r -. The first 0 means that in 0744 the number given in octal. To do the same thing in symbolic form, we should have:
$ Chmod u + rwx g+ r o + r file
In fact, we added (+) or subtract (-) the file or directory rights. To change all the permissions (rwx) to the user, group (g) and others (o), we can use ‘a’ (all) that allows you to change all change with one option.
$ Chmod ax file
This removes execute permission to everyone on the “File” file. Chmod can be used recursively using the-R
$ Chmod-R u + rw / path / to / directory
chown:
To change the owner of a file, we have the chown command. We use it as follows:
To change the owner of a file, we have the chown command. We use it as follows:
$ Chown username / path / to / file
change the owner of the file and assigns the user ‘user’. Similarly, we can also change the file group
$ Chown user.group / path / to / file
change the owner of the file and assigns it to user ‘user and group’ group ‘. As the parameter chmod-R can make recursive implementation of the new property (ie directories and sub-directories).
chgrp
chgrp
This command allows us to change only the group:
$ Chgrp test / path / to / file
change the file group to the ‘test’ group. The argument ‘-R’ makes the recursive application.
0 comments:
Post a Comment