Home > Article > Operation and Maintenance > Steps: Add new user in Linux system
Linux user management: steps to add new users
In Linux systems, administrators can add new users through the command line so that Provide new users with system access. This article details the steps for adding a new user and provides specific code examples.
First, you need to log in to the Linux system as the root user. The Root user has full access to the system and can perform all operations including user management.
Use the following command to create a new user, where "newuser" is the user name you want to create. You can also replace it as needed:
sudo adduser newuser
You will be prompted to set the new user's password and other information. Follow the prompts to complete the new user setup.
You can choose to add the new user to one or more user groups. For example, add the new user to the sudo group to give it administrator rights:
sudo usermod -aG sudo newuser
You can switch to the new user identity and verify their access rights Whether the setting is correct:
su - newuser
After entering the new user's password, if the new user identity is successfully switched, it means that the new user has been successfully added to the system.
Through the above steps, you have successfully added a new user and assigned access rights to it. Please ensure that new users' permissions are set correctly to protect system security, and that user permissions are regularly reviewed and updated.
In Linux systems, user management is one of the basic skills that administrators must master. Through the operation guide in this article, I believe you can easily add new users and reasonably manage user permissions in the system. I wish you success in Linux user management!
The above is the detailed content of Steps: Add new user in Linux system. For more information, please follow other related articles on the PHP Chinese website!