Guide to Choosing the Right GPU Server for AI
Selecting the right GPU server is critical when buildin...
Managing users is a fundamental task for system administrators working with Linux. Whether you’re setting up a server or managing a development environment, knowing how to create new users is essential. This guide will walk you through the process of adding users on Linux using various methods and best practices.
Creating individual user accounts allows for better access control, file permission management, and system security. It enables each user to have a unique home directory, shell environment, and set of permissions.
There are several ways to add users on a Linux system. The most common methods are using the useradd
command or the adduser
command.
useradd
CommandThe useradd
command is a low-level utility to add users. Here’s the basic syntax:
sudo useradd [options] username
To create a new user named "john":
sudo useradd john
This command creates the user but does not set a password.
To create a user with a home directory:
sudo useradd -m john
The -m
option creates a home directory at /home/john/
.
To specify the shell (for example, /bin/bash
), use the -s
option:
sudo useradd -s /bin/bash john
If you want to set an expiration date for a user account:
sudo useradd -e 2024-12-31 john
This command sets the expiration date to December 31, 2024.
adduser
CommandThe adduser
command is a higher-level, interactive script that simplifies the user creation process.
sudo adduser john
The system will prompt you to provide a password, full name, phone number, and other details. This method is more user-friendly than useradd
.
Regardless of the method you use, you’ll need to set a password for the new user:
sudo passwd john
The system will prompt you to enter and confirm the new password.
Adding a user to a specific group can help manage permissions and access. To add a user to the "sudo" group, use:
sudo usermod -aG sudo john
This gives the user administrative privileges.
To verify if the user was created successfully, check the /etc/passwd
file:
cat /etc/passwd | grep john
To delete a user from the system, you can use the following command:
sudo userdel john
To delete the user along with their home directory:
sudo userdel -r john
If you frequently manage Linux servers and users, having a reliable and efficient cloud server can make your tasks much easier. We recommend SurferCloud for lightweight cloud servers. SurferCloud offers fast, secure, and customizable Linux environments, allowing you to manage users, deploy applications, and maintain system security with ease.
SurferCloud VPS Special Offers:
With the knowledge of adding users in Linux, you can now manage system access more efficiently. If you need a secure, stable server to test your user management skills, SurferCloud provides an excellent environment to practice and deploy your applications.
Selecting the right GPU server is critical when buildin...
What is the difference between SurferCloud's UHost and ...
Port 25 is the default port used for sending emails thr...