loader

Categories

One click apps (20 Articles)

Tutorials about the VPSie app templates

How To’s (168 Articles)

In this category goes all How To’s related to VPSie

PCS( 5 Articles)

Tutorials about different scenarios configuring VPSie private cloud
Jan 30, 2016

Secure Debian server - Remove default test user - VPS Security

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