Delete the Users

Jerry McAllister jerrymc at
Tue Apr 8 16:50:33 UTC 2008

On Tue, Apr 08, 2008 at 01:46:50PM +0800, Ruel Luchavez wrote:

> Hi..
> I could log-in as a root in the data server of my friend, he give me a task
> to delete some
> users that he added in the server few months ago.
> Unfortunately, I've tried reading in other blogs but none of them is
> correct, there are some
> but at the end its not what i want.
> I know how to add users using command "adduser' but i cant trace after I add
> user where should
> be its directory?where could i find the list of users in the server? what
> would be the command to delete
> the user?

If you have root,   then run  vipw(8).
Look at the entry of the user you want to delete.  It will list the
home directory for that user.    

Presuming you want to remove everything about that user:
 - First delete everything in the home directory.   
 - The user's mail inbox is likely to be in /var/mail/USERID.    
 - There may be a crontab file.
   Check that with   crontab -u USERID -l     If there is nothing there
   don't worry about it.

 - and then use    find(1)  to find all the remaining files and directories 
   owned by that id.   rm them if you want to.   If any of them are files
   that other account also use, you may have to think out deleting them.

Once you have removed all the files you want to, then go back
to vipw and delete the entry from the password file.   vipw will
manage both the  /etc/passwd   and   /etc/master.passwd   as well as
the system password database  correctly for you.
Don't try to edit /etc/passwd  or  /etc/master.passwd directly.

Of course, you can easily write a script in your choice of favorite
language (sh, csh, Perl, etc) to do all this and all you have to do
is enter in the user id.  Probably there are some out there already,
maybe even something in the base system.   But, I delete ids so rarely
that I have always done it by hand and not bothered to look.


> I really need your HELP..Thanks!
> _______________________________________________
> freebsd-questions at mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at"

More information about the freebsd-questions mailing list