| Red Hat This forum is for the discussion of Red Hat Linux. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
09-13-2012, 07:02 AM
|
#1
|
|
LQ Newbie
Registered: Sep 2012
Posts: 18
Rep: 
|
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?
|
|
|
|
09-13-2012, 07:13 AM
|
#2
|
|
Senior Member
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 2,760
|
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)
|
|
|
|
09-13-2012, 07:25 AM
|
#3
|
|
LQ Newbie
Registered: Sep 2012
Posts: 18
Original Poster
Rep: 
|
delete home dir
Hi there,
r u saying that i should use rmdir /home and remove all of its content?
|
|
|
|
09-13-2012, 08:17 AM
|
#4
|
|
Senior Member
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 2,760
|
no, rmdir /home/alice would be better. do not remove /home! be care about removing anything, it can be dangerous!
|
|
|
|
09-13-2012, 08:53 AM
|
#5
|
|
Moderator
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 10,343
|
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.
|
|
|
|
09-13-2012, 09:21 AM
|
#6
|
|
LQ Newbie
Registered: Sep 2012
Posts: 18
Original Poster
Rep: 
|
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?
|
|
|
|
09-13-2012, 09:36 AM
|
#7
|
|
Member
Registered: Aug 2012
Distribution: Ubuntu 10.04, CentOS 6.3, Windows 7
Posts: 96
Rep:
|
|
|
|
|
09-13-2012, 09:40 AM
|
#8
|
|
LQ Newbie
Registered: Sep 2012
Posts: 18
Original Poster
Rep: 
|
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?
|
|
|
|
09-13-2012, 09:56 AM
|
#9
|
|
Member
Registered: Aug 2012
Distribution: Ubuntu 10.04, CentOS 6.3, Windows 7
Posts: 96
Rep:
|
|
|
|
1 members found this post helpful.
|
09-13-2012, 10:00 AM
|
#10
|
|
LQ Newbie
Registered: Sep 2012
Posts: 18
Original Poster
Rep: 
|
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
|
|
|
|
09-13-2012, 10:06 AM
|
#11
|
|
Member
Registered: Aug 2012
Distribution: Ubuntu 10.04, CentOS 6.3, Windows 7
Posts: 96
Rep:
|
Try this:
Code:
rm -rf /var/spool/mail/alice
In the future when you delete a user, make sure to include the -r option with the userdel command as this will remove the home directory and user's mail spool (that is, if you want that to happen).
|
|
|
|
09-13-2012, 10:08 AM
|
#12
|
|
LQ Newbie
Registered: Sep 2012
Posts: 18
Original Poster
Rep: 
|
thank you soo much for the prompt reply.. i am studying for the RHCE exam ... 
|
|
|
|
09-13-2012, 10:09 AM
|
#13
|
|
Member
Registered: Aug 2012
Distribution: Ubuntu 10.04, CentOS 6.3, Windows 7
Posts: 96
Rep:
|
No prob, please mark the thread as solved and feel free to give me rep points 
|
|
|
1 members found this post helpful.
|
09-13-2012, 10:11 AM
|
#14
|
|
LQ Newbie
Registered: Sep 2012
Posts: 18
Original Poster
Rep: 
|
by the way how do i delete all the spool mails for all the users at once?
is there a command?
thank you
|
|
|
|
09-13-2012, 10:26 AM
|
#15
|
|
Member
Registered: Aug 2012
Distribution: Ubuntu 10.04, CentOS 6.3, Windows 7
Posts: 96
Rep:
|
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.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:31 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|