DebugFactor.com | Forum

How to delete a user in RHEL

How to list and delete users in RHEL?

To remove a user from RHEL, use the userdel command.

userdel -r joe

-r flag removes the files from the users home directory E.g. /home/joe and users mail spool.

To list all users in linux,

[root@testvm opt]$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
....
joe:x:502:503::/home/joe:/bin/bash