Linux Create, delete users and user groups; Change password

Source: Internet
Author: User

1.useradd Add user-G first Group-G-Time group-D specified directory-p (passwd) password-u (UID)
2.userdel Delete User

Usage: # useradd xiaodandan-g xiaodaodan-p 111111 explanation Create a new user Xiaodandan, user group is Xiaodandan, password 6 1

3.groupadd New Group Ls-l View group under home directory-rw-r--r--root root third character root belongs to the root group
4.groupdel Delete Group
5.usermod-g Modifying user groups
-G Add User Group

用法: # usermod -g xiaodaodan xiaodandan        解释:xiaodandan修改用户组为xiaodaodanusermod   -L    户名(锁定用户)                  -u     户名(解除锁定)

6.PASSWD Change Password

Usage: # passwd user Name
New UNIX passwd: Enter the password here
Retype new UNIX passwd: Enter the password again
passwd all ..... Omitted: Done

cat/etc/passwd
Display: Root:x:0:0:root:/root:/bin/bash
First character: User name
Second character: password (password), password generally in /etc/shadow
Third character: 0 on behalf of rooot:1-499 Management account: 500-x General Account
Sixth character: Represents the root directory/root
Normal User/Home

Cat/etc/shadow
Display: root:$ omitted
: Bin:: 17623:0:9999:7:::
First character: User name root corresponds to passwd
Second character: password
Third character: 366
(2018-1970) + (2018-1970)/4+1=17632
Common year 365 leap year: 366
* Fourth character: A few days before you can change your password
The fifth character: a few days must be password, general 9999 is the default permanent
Sixth character: Tips for days before password expiration
Seventh character: After the password expires, lock it in a few days

Add: Head: Show front 10 lines
Tail: Show the following 10 lines
Move: Page view

Usage: Cat/etc/shadow |head

Add: Chgrp: Modify file, directory belongs to group
CHGRP Group name File name
Chown: Modify File Owner
Chown-r Account name File name

Linux Create, delete users and user groups; Change password

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.