1. Add a new user. Because the permission of the root user is too large for daily use, add a user for daily use or for others to use. 1) Create a new user: adduser hadoop 2) Change the password of the new user: passwd hadoop 2. Authorize the newly created user to use the sudo command. Chmod -v u+w /etc/sudoers chmod -v u+w /etc/sudoers chmod -v u+w /etc/sudoers Hadoop ALL=(ALL) ALL Hadoop ALL=(ALL) NOPASSWD:ALL 3) Revoke sudoers' write permission chmod -v u-w /etc/sudoers
1. Create user adduser testuser // Create user testuser passwd testuser // Set a password for user testuser 2. Groupadd testgroup // Create testgroup 3. Useradd -g testgroup testuser // Create user testuser and add it to testgroup workgroup // Note: : -g owning group -d home directory -s SHELL 4. Add a workgroup to an existing user. Usermod -g groupname username 5. In /etc/shadow, add the second field (password) in front of the user's line. To restore the user, delete the user account or run the following command to disable the user account: passwd testuser -l // Release the user account again: passwd testuser -u 6. Delete user account userdel testuser groupdel testgroup usermod -g testgroup testuser // (forcibly delete the user's home directory and all files and subdirectories under the home directory) 7. User list file: /etc/passwd User group list file: /etc/group View the users in the system: cut -d: -f 1 / etc/passwd view can login system users: cat/etc/passwd | grep -v/sbin/nologin | the cut - d: -f 1 View user information Operations: w Command (root permission required) View user information: w User name View login user information: who View user login history information: last