Introduction
Managing user accounts on your Linux VPS is vital for maintaining security and organization. This guide walks you through the processes of creating new users, modifying existing ones, and deleting users when necessary.
Step-by-Step Guide
Step 1: Adding a New User
- To add a new user, use the
adduser
command followed by the username:sudo adduser newusername
- Follow the prompts to enter the password and fill out additional user information.
Step 2: Modifying User Accounts
- You can modify a user account using the
usermod
command. For example, to change a user's username:sudo usermod -l newusername oldusername
- To change a user’s home directory:
sudo usermod -d /new/home/directory username
Step 3: Deleting a User
- To remove a user account, use the
deluser
command:sudo deluser username
- To delete a user along with their home directory and files:
sudo deluser --remove-home username
Step 4: Managing User Group Memberships
- Add a user to a group:
sudo usermod -aG groupname username
- View a user’s group memberships:
groups username
Conclusion
With this understanding of user management on Linux, you can effectively control who accesses your VPS and what they are permitted to do. Regularly reviewing and updating user permissions and accounts helps maintain a secure and efficient server environment.
Disclaimer
Always ensure that you have appropriate permissions to manage user accounts on your system. Making unauthorized changes could disrupt service and lead to security issues.