Manage users and commands for setting up permissions
Command |
Description |
Command |
Description |
chmod |
Used to change permissions |
Useradd |
Used to increase the user |
Su |
Used to modify a user |
|
|
5.1 chmod Command
The chmod command is used to change license permissions. Read, write, and execute are the three main settings in the license permissions. Because users are programmed into a group when their account is created, they can also specify that the group can read, write, or execute a file. which
R-Files can be read
W-Files can be written
X-Files can be executed if the file is a program
You can use the LS command with-l to carefully view many details of a file.
The chmod command is used to set permissions on a file. Standard usage:
chmod (+,-, =) permission name (r,w,x) file for user (u,g,o,a) of the file
User of the file |
Description |
Permissions |
Description |
Changes |
Description |
U |
The user who owns the file |
R |
Read Right |
+ |
Add permissions |
G |
The group where the owner resides |
W |
Write right |
- |
Delete permissions |
O |
The others |
X |
Executive power |
= |
is what it calls unique permissions |
A |
All (U,g and O) |
|
|
|
|
To delete all permissions for a file, enter a command:
chmod a-rwx Test.txt
To add permissions to the file owner, enter the command:
chmod u+rwx Test
You can also use numbers to indicate permissions: 4--read, 2--write, and execute. The following two commands are equivalent:
chmod 751 filename
chmod u+rwx,g=rx,0=x filename
5.2 su Command
The SU command is used to modify the user. This is a very important command that allows an ordinary user to have access to superuser or other users. However, this command must have a superuser or other user's password to become a superuser or other user. If you want to leave, you can enter exit. Standard usage:
SU user name (default to root if no user name is entered)
For example, assuming that the current user User01 and want to transition to USER02, enter the command:
Su User02
System returns:
Password
At this point, enter the USER02 instruction and it will become user02.
5.3 useradd Command
The Useradd command is used to increase the user, only the root user can increase the user. If you are not logged in as the root user, enter Su, and then enter the root password.
To add a user, enter a command:
Useradd User Name
Then, follow the prompts to enter a password for the new user.
Linux basic Commands (5) Manage users and commands to set up permissions