[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: fully removing a user?



Monique Y. Herman wrote:
> So, I've noticed that my home machine has some accounts lying around
> that are certainly unused -- I set up a user so that a friend could use
> my disk space, that sort of thing.

Lint in the dryer filter...

> Got me thinking ... okay, you use 'userdel -r foo', and it gets rid of
> the passwd entry, home directory, and mailspool ... 

The 'userdel' command is one of those "standard" commands which is so
poorly standardized that every system has a different implementation.
Trying to write portable package install scripts has driven me crazy
with this command.  It is very difficult to use portably.  I can't
recommend it unless you really work hard to get it right.

Debian uses 'adduser' and 'deluser' to good effect.  They are so much
friendlier to use than the standard commands that this is one of the
few times you will hear me suggesting to use a non-standard command.

> It's also occured to me that the user may have cron jobs installed.
> What other things might a user have that aren't automagically handled?

Use the --remove-all-files option.

  man deluser

  deluser --remove-home --remove-all-files user

Usually I would not be so concerned as to run a find on the entire
disk (which is effectively what the above does).  Instead I would look
at /var/mail, /var/spool/{atjobs,crontabs} and that is it.  If you
gave them 'staff' privileges then check /home and /usr/local.  If you
gave the 'src' privileges then check /usr/src.

Bob

Attachment: pgpFu5eNkbCAi.pgp
Description: PGP signature


Reply to: