Close this search box.

Secure Debian server – Remove default test user – VPS Security

Table of Contents

Some Debian versions have default users that could be a security risk – so before your VPS server gets compromised its best to delete un-wanted users

We will provide 2 options:

A- One-line command:

Those commands would help you with the process:

1- Login to your server as root. 

2- Run following one line command: (Copy and Paste”

passwd -l test && ps -ef | grep test | awk ‘{print $2}’ && kill -9  $(ps -ef | grep test | grep -v grep | awk ‘{print $2}’ | tr ‘\n’ ‘ ‘) && userdel -rf test

Replace “test” with the user you would like to clean up.

B- Manual commands

first try locking the account using

passwd -l test

Delete the user using:

/usr/sbin/userdel test

If it returns a message saying that the user is currently logged in. You could find all processes running by this user and kill them all as root.

pgrep -u test
ps -fp $(pgrep -u test)
killall -KILL -u test
userdel -r test

Replace test with the actual user you want to kill processes for.


Hope that helps!

If you don’t have a VPSie server yet – We recommend you take advantage of our one month free trial using this link

Make a Comment
Share on
VPSie Cloud service

Fast and Secure Cloud VPS Service

For a month

The First 1 orders gets free discount today! Try Sign up on VPSie to get a chance to get the discount.