Linux basic Commands (5) Manage users and commands to set up permissions

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.