How To Delete User With Home Directory In Linux Rehat
Commands For Delete User that you Made In Linux Redhat.
Using Userdel Commands
What is userdel
Userdel is a low level utility for removing users. On Debian, we should usually use deluser command. Userdel will look the system account files such as /etc/password and /etc/group. Then it will deleting all entries related to the user name. The user name must exist before we can delete it.Userdel is a tool to delete a user inside Linux system. Userdel also a backend of deluser command, a perl script to delete a user. As usual, you can always type man userdel to explore more detail about userdel command.
How to use Userdel
Since userdel will modify system account files, we need root privilege to run it. Otherwise we will have an error message that saying “only root can do that” or similar. After we gain root privilege, we can delete a user by typing userdel from your console. Here’s a sample of default usage of userdel.
# userdel amit
$ sudo userdel amit
user home directory
Using userdel without options, will only delete the user. User home directory will still remain at /home folder.
Force delete a user
Userdel provide -f option to force user deletion. This option will delete a user even the user still log in into Linux system
when we do “userdel -f amit” the command only show us the information that the user is logged in. The command itself was succeed. If we see the content of /etc/passwd file using cat command, we don’t see pasadena user there. It’s home directory still exist but the owner is changed.
One thing that we must know that, userdel with -f option did not broke the SSH connection. So the user actually still logged in and active even the user is not exist. But when the user log off, the the user can not log in anymore because that user has been deleted.
How To Use These Commands In Linux Watch this Video. If you Like Please Don't Forget to Like Share Subscribe.

Leave a Comment