How to Delete a User on a VPS?

If you need to delete a user from a Virtual Private Server (VPS), it’s quite easy to do, but it requires some knowledge of working with the command line. In this article, we will look at how to safely delete a user on a VPS.

Before you begin, make sure you have access to the VPS via SSH or other remote access means. Also, make sure you have superuser rights or access to the sudo command.

Step 1: Log in to the Server

Open the terminal and log in to the server under a superuser (root) account.

ssh root@your_server_ip

VPS Hosting

Virtual servers with guaranteed resources

Choose VPS

Step 2: Check User Information

Before deleting a user, it’s helpful to check their information, such as their home directory, groups, etc.

id username

Step 3: Deleting the User

Now that you are sure you want to delete the user, execute the following command:

userdel -r username

This command will delete the user and their home directory. Be careful, recovering a deleted user can be a complex process.

Step 4: Verification

After deleting the user, make sure they no longer appear in the user list:

cat /etc/passwd | grep -i username

You have now successfully deleted the user from your VPS. Remember that deleting a user is a reversible process, so be careful.

We hope you found this post helpful. If you have any questions, feel free to contact our support team.