2016-6-21 Knowledge Points Summary

Source: Internet
Author: User

Switch user commands the difference between su and -su

    1. First, the root user can easily switch to any user without a practical password

    2. When a normal user switches to the root user, it needs to provide the root user's password, not the password of the normal user.

    3. When using the SU command to switch to the root user, although the user account is switched to root, but the shell with the ordinary user's own shell is not the root user's shell, environment variables are normal user environment variables

    4. When using the-SU command to switch users, the shell and environment variables are switched to the shell and environment variables of the user being switched, which is the essential difference between Su and-SU


The user file is present under the /etc/passwd file, this file has seven columns, separated by:



First column Second column Third column Fourth column Fifth Column Sixth column Seventh column
User name password, corresponding file/etc/shadow UID, the UID can be specified with the parameter-u=xxx, the default normal user is starting from 500, the special user is 0-499
GID can specify gid with parameter-g=xxx Explanatory notes The location of the home directory can be specified with-d=directory directory location

Specifies that the Shell,root user and the normal user are used by default
/bin/bash, you can use the parameter if you do not allow the user to log in-s=

/sbin/nologin or/bin/fals


Add user's command useradd parameter username-n Cancel group created with username-M does not automatically establish a user's login directory-f Specifies the number of days after the password expires the expiration date of the specified account-E


The user group's profile has five columns under the /etc/gropup file, separated by:

The second column Third column
group name
Group Password Group ID GID Normal group default starting from 500, System group is 0-499, specifying system group can use parameter-R, note, must be less than 499

The password file for the user group is under the /etc/gshadow file

Add a user group command groupadd parameter group name-G can specify the group ID, if you skip the median number, it will start with the last number set, such as setting the GID to 510, the next time if the default create group will start from 511, the middle will be empty, You can use-G to specify, delete the group if there are users inside, is not to delete the group, you must first delete the user, and then delete the group. Except for expansion groups.



2016-6-21 Knowledge Points Summary

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.