Redhat6 create users and user groups

#Create group ID 601 group name webapp

groupadd -g 601 webapp

#Create user ID 601 username webapp belongs to the webapp group

useradd -u 601 webapp -g webapp

#Modify the password of the password user webapp

passwd  webapp

#enter twice

webapp

 

Modify Group ID User ID

groupmod -g 501 webapp

usermod -g 501 webapp

Then

chown -R webapp:webapp

 

 

Delete to add redundant users, including the user's home folder to delete together

Enter the command: userdel –r webapp

How to view all user and group information in linux

View user information

cat /etc/passwd

Inquire

cat /etc/passwd|grep username to find a user

View user groups

cat /etc/group

Inquire

cat /etc/group|grep group name

 

User and Group Common Commands

groups View the group members of the currently logged in user

groups test View the group where the test user is located, and the members in the group

whoami View the current login user name

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326591846&siteId=291194637