Deleting User in Red Hat Linux
Dear all,
I am sorry and i am not sure if this is the right category to post this qns. Basically i have added a few users using the command: e.g useradd alice I accidentely deleted the user using: e.g userdel alice and not using userdel -r alice. when i use ls , i realise that the users are visible but the systems says users do not exist. May i know how to get rid of the users? |
I think user is now locked, unable to log in, but the files are still there, you need to remove home dir and other files also (owned by alice)
|
delete home dir
Hi there,
r u saying that i should use rmdir /home and remove all of its content? |
no, rmdir /home/alice would be better. do not remove /home! be care about removing anything, it can be dangerous!
|
Moderator Response
Moved: This thread is more suitable in <Red Hat> and has been moved accordingly to help your thread/question get the exposure it deserves.
|
delete home dir
Hi there,
When i do rmdir /home/alice it says that directory no empty. How do i delete the username that is visible but apparently not existing? |
try:
Code:
rm -r /home/alice |
delete home dir
hi there,
The rm -r /home/alice worked.. but the problem is that i have to type y for all the files that are deleted. Is it possible to force delete all the users without selecting y or yes all the time? |
Sure, try:
Code:
rm -rf /home/alice |
that worked perfectly fine. a huge thank you :P
by the way when i add the same user again it says creating mailbox file:File exist this comment normally wont be prompted when a new user is added. any reason why and how to avoid this? thanks in advance |
Try this:
Code:
rm -rf /var/spool/mail/alice |
thank you soo much for the prompt reply.. i am studying for the RHCE exam ... :)
|
No prob, please mark the thread as solved and feel free to give me rep points :)
|
by the way how do i delete all the spool mails for all the users at once?
is there a command? thank you |
I've never had to do that before, so I'm not really sure if there's a command to do that. Depending on the number of users in your system, I'd write a script to purge their mail spools one by one.
Just be sure to be careful when you do this (if you do this in a real world situation) because without proper backups it's 100% assured that someone will need one of the e-mails you delete somewhere down the line. |
ok thank you for the tip and advice and i will take that into account. :P
|
thank you for the advice and tips :P
|
All times are GMT -5. The time now is 07:37 PM. |