Create User Linux: Step-by-Step Guide

To create a new user in Linux, you can use the useradd command. The following are the steps to create a new user:

  1. Open the terminal window.
  2. Create a new user with the username “新用户名” with a home directory and set the shell to /bin/bash.
  3. The sudo command is used to execute commands with administrator privileges.
  4. The useradd command is used to create a new user.
  5. The option “m” is used to automatically create the main directory for a user.
  6. The -s option is used to specify the default shell for a user.
  7. The new username is the username of the new user you want to create.
  8. After pressing the Enter key to execute the command, you will be prompted to enter a password. Input a secure password and press Enter.
  9. Please re-enter your password to confirm, and press the Enter key again.
  10. Change the password for the new user.
  11. The sudo passwd command is used to change a user’s password.
  12. The new username is the username of the new user you just created.
  13. Enter a new password following the instructions, and enter it again to confirm.
  14. Switch user to the new username
  15. The su command is used to switch users.
  16. The option is used to switch to the account of a new user, and load their environment variables and configuration files.
  17. The new username is the username of the new user you just created.

You have successfully created a new user in Linux.

bannerAds