Bill Hogan writes: > Now I have a new user named `--version' that I would like to delete only >I can't seem to find a command that undoes what `adduser' does. > > What is the best way to deal with this kind of situation?
Someone should write a `deluser' program and it should get it right... If no-one else volunteers I could give it a shot... * delete user from /etc/passwd and remove their group from /etc/group. Remove their login name from any group membership lines in /etc/group. * delete mail spool file (what if it's nonempty?) * delete home directory. What do we do about saving files? * delete crontab (maybe there'll be something in the atjobs or atspool directory which needs fixing too?) * maybe clean up /var/lib/emacs/lock/* (or should something else be doing this? I have a bunch of fairly old files in there...) * do something sensible with files owned by the user or their group under /var/catman and /var/spool/texmf. * maybe clean up files owned by the user or their group under /tmp and /var/tmp? * what about files owned by this user in other directories? (Shared projects, etc.) * what if the user has processes running? Or a print job queued? Or mail queued? * there should be a man page ;-) Anything I've forgotten? Any NIS issues? (I'm not familiar with NIS at all, which may be a good reason for someone else to do this.) All this business about deleting crontabs, etc, suggests that there should perhaps be a more generalised way of deleting user files in spool directories etc. Perhaps it should run any executables in /usr/lib/deluser with the login name as an argument? As to saving user files, Unixware's deluser has the following... Yes | No This argument determines whether or not the user's files should be saved when his or her login name is removed. If Yes is specified, all files in the user's home directory are copied to /lost+found/login_name before the home directory is removed. If No is specified, the files in $HOME are not removed. Perhaps Debian's deluser should have a similar feature, though perhaps with a more sensible command line syntax. Maybe it should be possible to delete everything from the home directory except a .forward file. -- Richard Kettlewell [EMAIL PROTECTED] http://www.elmail.co.uk/staff/richard/