Home >Operation and Maintenance >Linux Operation and Maintenance >How to add new users in Linux system
How to create a new user in the Linux system
As an open source operating system, the Linux system has excellent security and flexibility, and also supports multiple users and multiple users. The context of the task. In Linux systems, creating new users is a common operation, allowing different users to have their own accounts, permissions, and personal spaces on the same computer. This article will introduce how to create a new user in a Linux system and give specific code examples.
1. Use the command line to create a new user
In the Linux system, you can use the command line tool to create a new user. Open a terminal and enter the following command:
sudo adduser new_username
This command will create a new user and ask for the new user's password and some other information. After confirmation is completed, the new user will be successfully created. If you need to set a password, you can use the following command:
sudo passwd new_username
During this process, you can enter the new user's password in sequence according to the system prompts, and confirm the password to complete the password setting.
2. Set the permissions of new users
In the Linux system, you can use some commands to set the permissions of new users to ensure that they can access the required files or directories. For example, you can use the following command to add a new user to the sudo group and obtain administrator rights:
sudo usermod -aG sudo new_username
This command will add the new user to the sudo group so that it has administrator rights. This allows new users to perform tasks that require administrator privileges.
3. Delete new users
If you need to delete a new user that has been created, you can use the following command:
sudo deluser new_username
This command will delete the specified new user, and you can choose Whether to delete its home directory and mailbox, etc.
4. Summary
Through the above introduction, we can see that creating a new user in the Linux system is a simple and important operation. Through command line tools, we can easily create, set permissions and delete new users to meet system management needs. I hope the above content is helpful to you, thank you for reading.
The above is the detailed content of How to add new users in Linux system. For more information, please follow other related articles on the PHP Chinese website!