Summary of four user management for study notes of destiny LINUX

Source: Internet
Author: User

 

There are three types of users in linux:

1: The Super User root has the permission to operate everything. The UID value is 0.

2: normal user: UID 500---60000 with limited operating system Permissions

3: pseudo-user: to facilitate system management and meet the requirements of the owner of the corresponding system process file, you cannot log on between UID 1---499.

 

User Management: passwd/etc/passwd defines only accounts, not passwords.

Example: root: x: 0: 0: root:/bin/bash

Six: The number is divided into seven parts

Root: Account name

X: indicates a password.

0: User ID (User ID)

0: Group id (User Group id)

Root: user information.

/Root user's home directory

User Environment:/bin/bash

Using echo $ SHELL to view the SHELL in which the user group is located

Create user: useradd zlyzhang

Passwd zlyzhang

Vi access

/Etc/shadow. Only the root user can read this file and it is composed of nine fields separated by a colon.

For example:

Root: User example

Root: $1 $6Xv8mUT1 $ IzPlyczUKcCPYqQwptnvw1: 14982: 0: 99999: 7 :::

Nscd :!! : 14982: 0: 99999: 7 :::

Username: root

Password: stores the encrypted password. If the first character of the password is! Exclamation point, the user cannot log on

Last modification time

Maximum time interval: 0 indicates changes at any time

Minimum interval: 99999 indicates that the device never expires.

Warning time: 1 week

No activity time:

Expiration time:

User Account Management:

Command to create an account: useradd account or adduser-u-g-G-d-s-c-e-k-n-N-r has these Command Options

Passwd Password

 

Delete user; userdel account

If the file in the userdel-r account's home directory is deleted,

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

Change Username:

Example: useradd redhat

Passwd lamp

Account Created successfully: You need to change the username,

Usermod-l zhangluya redhat

In this case, you can change the user login name.

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

Locked account: usermod-L thisuser

Unlock: usermod-U thisuser

Stop account: Add # (the beginning of the first line) before the account line, but it is different from deleting files. Comment out.

Password Management:

Passwd-S (uppercase) redhat to view the password status:

Passwd-l destiny password locked

Passwd-u destiny unlock Password

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

Add: Specify the group at creation: useradd-g ttt kkkkk

Kkkk users are in the ttt Group

 

Passwd press enter to change the current user password

If you want to change the password of another user:

Passwd username

Switch user identity: su username

Switch su-username to the user's home directory

-D directory: Specifies the user's main directory. If this directory does not exist, you can use the-m item to create a main directory.

-G user group: Specifies the user group.

-G User Group specifies the user's additional group useradd-g root-G linux Jesse

-U user number, specifying the user number

Example:

Useradd-d/usr/edu

Create a user edu

Here,-d is used to generate a main directory/usr/edu for the login name edu (/usr is the parent directory of the default user main directory)

Delete user: When userdel-r Jesse deletes a user, the user's home directory is also deleted.

User Password Management:

Passwd-d redhat

The redhat user does not need a password when logging on.

Locked account:

Passwd-l redhat so that users cannot log on

Lock -- l

Unlock: passwd-u redhat

U = unlock

 

Add group:

Groupadd redhat

/Etc/group is saved here

Delete group: groupdel redhat

 

This article is from the "jesse's blog" blog

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.