How to remove a user in Centos 7?

kumkumsharma

Administrator
Staff member
If you want to remove unwanted user from your server then you can follow below steps:

You can run below command to delete the user:

Here username is “hoststud”.

Code:
Userdel hoststud
With this if you want to remove all the files which are related to the user then you have to add –r:

Code:
Userdel –r hoststud
Now we have to remove root privileges of the user, for that first you have to use vim editor:

Code:
Visudo
Now find below code in file :

Code:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
hoststud ALL=(ALL) ALL
Now you have to remove below line from file:

Code:
hoststud ALL=(ALL) ALL
 
Top