Linux Experiment 1 User and User Group Operation

User and group management

1 Create a group, the group name is jk-wangjian, the GID is 600, and the alias of the created group is jk-wangjian-2

groupadd -g 600 -o jk-wangjian

groupadd -g 600 -o jk-wangjian-2

tail /etc/group

2 Create an ordinary user, the account name is "initial of the name", the remark is "the full spelling of the name", the initial password is: 123456, and the user is prompted to change the password when logging in for the first time. The user is required to change the password every 90 days, and the UID is set to 600, the main directory /home/"initial", the main group is jk-wangjian, the shell is /bin/bash,

useradd -c zhangheren  -u 600 -d /home/zhr -e 90 -g jk-wangjian -s /bin/bash zhr

passwd zhr

chage -M 0 zhr

3. Log in to the system as this user

su - zhr  #-的意思是登陆是切换到用户的家目录

4 Use cat, more, tail and other commands to view the contents of the group document group

cat /etc/group

more /etc/group

tail /etc/group

5 View the UID of the user's "initial", the main group

id zhr

6 View the home directory, login shell, and last login time of the user’s “initial”

yum install -y finger

finger zhr

7 View the contents of passwd

cat passwd

8 Modify the user information created by 2, modify the UID to 800, and the home directory to /home/"initial-2",

usermod -d /home/zhr-2 -u 800 zhr

9 Delete the user created by 2 and delete its home directory

userdel -rf zhr

Guess you like

Origin blog.csdn.net/qq_45477065/article/details/124358444