Centos manually create a new user

Source: Internet
Author: User

When we want to create a user, we usually use the Useradd command to automatically create a user, in fact, under Linux, everything is file, set several files, but also can create a user:

The file is as follows:

/ETC/PASSWD: User

/etc/shadow: Password

/home/username: User Home Directory

/etc/group: User groups

/etc/skel/*: The file in this directory is actually the skeleton of the file under the user's home directory. Under the Useradd command, it is automatically copied to the/home/username

----------------------------------------------------------------------------------------------

Create a user User01 based on the above file:

1. Use Nano to edit/etc/passwd, add it on the last line:

650) this.width=650; "alt=" 1427606600403230.jpg "src=" http://blog.magedu.com/ueditor/php/upload/image/20150329/ 1427606600403230.jpg "/>

Format description

User name: Password placeholder: uid:gid: Home directory path: Default shell

2. Use Nano to edit/etc/passwd, add it on the last line :

650) this.width=650; "alt=" 1427606898136953.jpg "src=" http://blog.magedu.com/ueditor/php/upload/image/20150329/ 1427606898136953.jpg "/>

Format description

Group name: Password placeholder: GID: comma-delimited list of users belonging to this group (as an additional group)

3, Cp-r/etc/skel/home/user01, and view copy of the past files

650) this.width=650; "style=" float:left; "alt=" 1427606365362537.jpg "src=" http://blog.magedu.com/ueditor/php/ Upload/image/20150329/1427606365362537.jpg "/>







Recursively modifies the owner and genus of the directory:

650) this.width=650; "title=" 1427608032871772.png "alt=" Blob.png "src=" http://blog.magedu.com/ueditor/php/upload/ Image/20150329/1427608032871772.png "/>

650) this.width=650; "title=" 1427608049124208.png "alt=" Blob.png "src=" http://blog.magedu.com/ueditor/php/upload/ Image/20150329/1427608049124208.png "/>

4, then modify the permissions of the file, only belong to the main group to have permission

Use SU-switch user, find user can log in

650) this.width=650; "title=" 1427608279113966.png "alt=" Blob.png "src=" http://blog.magedu.com/ueditor/php/upload/ Image/20150329/1427608279113966.png "/>

5, however, through the pseudo-terminal, you need to enter a password, so you need to add a new user in the last line of/etc/shadow, and to configure the password for the new user.

650) this.width=650; "title=" 1427608640115784.png "alt=" Blob.png "src=" http://blog.magedu.com/ueditor/php/upload/ Image/20150329/1427608640115784.png "/>

Format description

User name: encrypted password: Last time password change: password minimum Age: Password maximum age (excluding the start date): password Expiration warning interval : password inactivity period (change password, others can not change): Account Expiration period: Reserved area

Therefore, you need to generate a password:

650) this.width=650; "title=" 1427609896869566.png "alt=" Blob.png "src=" http://blog.magedu.com/ueditor/php/upload/ Image/20150329/1427609896869566.png "/>

Put it in the/etc/shadow "!!" Position:

650) this.width=650; "title=" 1427609934941985.png "alt=" Blob.png "src=" http://blog.magedu.com/ueditor/php/upload/ Image/20150329/1427609934941985.png "/>


Above, the user adds it to the end.




Centos manually create a new user

Related Article

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.