Removing a user.

Scott plug-discuss@lists.plug.phoenix.az.us
Tue, 11 Feb 2003 20:50:56 -0700 (MST)


On Tue, 11 Feb 2003, Michael Havens wrote:

> How is it done? I had created a user and decided later that I wanted it to be 
> in another location so I dragged the users directory to the garbage gin as su 
> and:

Dragging the users directory to the garbage bin will only remove the 
directory.  The users account, in /etc/passwd, still exists.

> 
> [root@localhost bmike1]# adduser -m test -d /home2
> adduser: user test exists
>

There are a few ways to remove an account - all are ultimately the same in 
the end - from a command line use userdel.  IE

userdel [-r] username

The -r - if used - will remove the users home directory in addition to 
removing the account.  Leaving the -r off will remove the user but leave 
the home directory intact (this is sometimes desirable).

Another method would be to use a gui tool (I think there are several).  
The gui tool usually works in this manner:

Select (hilight) ther user you want to remove and click the remove button.  

Depending on the particular gui tool, you may be prompted to remove the 
home directory, etc.

> so I decided a new nane wasa in order because it would not accept 'test'.
> 
> [root@localhost bmike1]# adduser -m Downloadtest -d /home3
> 
> and I thought "Better make sure it is where I want it.
> 
> [root@localhost bmike1]# updatedb
> locate [root@localhost bmike1]# locate Downloadtest
> /var/spool/mail/Downloadtest

This command is not ideal for finding the just created home directory.  
Locate is going to look for all files that are owned by the specified 
user.  Hmmmm..... now that I think about it, it should have found the home 
directory - unless for some reason its not owned by Downloadtest.  Try the 
finger command.  Using my account as an example, it would look something 
like this:

finger sbrews
login: sbrews		name: scott
directory: /home/sbrews ...

complete output not pasted - but you get the idea.  Note the directory for 
the user.

> 
> Why didn't it go to /home3?
> 

-- 
NT makes anything simple, easy, and anything difficult to do, impossible.
Unix makes anything easy to do difficult, and anything difficult to do,
possible.  Basically, if your VCR is still flashing "12:00" then unix is not
for you!