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:
- Open the terminal window.
- Create a new user with the username “新用户名” with a home directory and set the shell to /bin/bash.
- The sudo command is used to execute commands with administrator privileges.
- The useradd command is used to create a new user.
- The option “m” is used to automatically create the main directory for a user.
- The -s option is used to specify the default shell for a user.
- The new username is the username of the new user you want to create.
- After pressing the Enter key to execute the command, you will be prompted to enter a password. Input a secure password and press Enter.
- Please re-enter your password to confirm, and press the Enter key again.
- Change the password for the new user.
- The sudo passwd command is used to change a user’s password.
- The new username is the username of the new user you just created.
- Enter a new password following the instructions, and enter it again to confirm.
- Switch user to the new username
- The su command is used to switch users.
- The option is used to switch to the account of a new user, and load their environment variables and configuration files.
- The new username is the username of the new user you just created.
You have successfully created a new user in Linux.