CentOSVPS tutorial (2) users and permissions after successfully logging on to the server as a root user, the next step is to create some non-Super Administrator users for your server. Why not only use the root user to manage VPS? because the root user has the highest permissions in linux, it can modify the text at will... centOS VPS tutorial (2) users and permissions after successfully logging on to the server as a root user, the next step is to create some non-Super Administrator users for your server. Why not only use root users to manage VPS because root users have the largest permissions in linux, they can modify arbitrary files in the file system (including deleting files, of course) at will ), this poses a high risk to programs running as root. We can create different users so that they have different operation permissions for different files and programs to avoid unnecessary troubles caused by a user's excessive permissions, this ensures that all files and programs in the system are well organized. In Linux, users and groups are two related concepts. A group consists of multiple user groups, and a user can belong to multiple groups. Because the management of a single user is too complex, many users usually have similar or repeated user permissions, or they can share a directory, you can manage permissions of users in this group in batches through the management group. How to manage user creation or deletion must run with the root permission. Create a user, for example, create a user named scott 1 # useradd scott set a password for the newly created user 1. root add 1 # passwd scott 2 for it. the user initializes the Password 1 $ passwd to delete the user. for example, delete user 1 # while userdel scott deletes the user, delete The Archive 1 # userdel-r scott under his Directory. check that all users are written to the/etc/passwd file, you can display this file to show all users 1 # cat/etc/passwd before the first colon is the user name. How to create a group in a management group. for example, when creating a group named group_name in group 1 # groupadd group_name, you can also assign a group to a user while creating a user, for example, creating a scottde and assigning the user to the group_name group at the same time. 1 # useradd scott-G group_name if the group parameter is not added, by default, the system assigns a group with the same name (in the above example, scott is allocated to the scott Group ). To delete a group, for example, to delete group 1 # groupdel group_name: the permissions of users and groups are specified in any file or folder in Linux. Run the following command to display the permissions of files and folders in the/usr path: 1 # ls-l/usr part. the returned results are as follows, 1 Total 1402drwxr-xr-x 3 root 20480 06-22 bin3drwxr-xr-x 2 root 4096 etc4drwxr-xr-x 2 root 4096 games front section is the permission attribute of the file. The first character d indicates a folder. if it is-, it indicates a file. The following nine characters indicate the permissions of three users for the file. We can split the following nine characters into three parts to see rwx r-x. These three parts refer to the owner user (root here), the owner group user (root here, the second root), and other users who have read, write, and execute permissions on files. We can intuitively see that r refers to read permission, w refers to write permission, and x refers to execution permission. However, if they are replaced by "-", they do not have this permission. For example, assign permissions to a file readme.txt: The user has the read, write, and execution permissions, and the group has the read and write permissions. other users do not have the permissions. 1 # chmod 760 readme.txt the preceding three numbers correspond to the permissions of the user, group, and other users respectively. In this case, 17 = 111B26 = 110B30 = 000B, that is, the binary numbers corresponding to the rwx values. If you simply grant or revoke a certain permission, you can use the following: for example, add read and write permissions to the user, 1 # The chmod u + rw readme.txt u table shows the user, the corresponding g indicates the group, and o indicates that other users (other) + indicates the authorization, -indicates deprivation. Rw indicates the read and write permissions.
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