virtual server hosting

Removing users from your system is probably the simplest operation you will do.

rmuser
The rmuser command deletes a user from the server. It will also delete the user’s home directory as well if prompted Use the rmuser command.

# rmuser joe

This will prompt you with:

Matching password entry:
:$1$RzJXr6ka$xdE88TjW4vpwthy/.Vtho/:1004:1004::0:0:Joseph \
Carmichael Schmoe:/home/:/usr/local/bin/tcsh
Is this the entry you wish to remove?

at which you simply type a 'y' and enter. You will also be prompted to remove their home directory:

Remove user's home directory (/home/)?

Note: If you reply affirmatively, the home directory will be completely removed. Otherwise, the directory will continue to exist.

If you know you want to remove everything, use the -y option for rmuser, which will answer 'y' automatically at all questions:

# rmuser -y
Updating password file, updating databases, done.
Updating group file: (removing group  -- personal group is empty) done.
Removing user's home directory (/home/): done.
Removing user's incoming mail file /var/mail/: done.
Removing files belonging to  from /tmp: done.
Removing files belonging to  from /var/tmp: done.
Removing files belonging to  from /var/tmp/vi.recover: done.
Removing existing users by hand is not covered in this tutorial, except to say that the password file entry, group entries, home directory, mail spools, cron jobs, and other miscellaneous files need to be considered when removing users.

rmuser does all of this for you, and does it well.

pw
The -r option is the inverse of -m. While -m instructs pw to create the home directory, -r tells pw to remove the home directory and its contents without prompting. pw is slightly more dangerous than rmuser, but perhaps more suitable for automation.

-r tells pw to remove the user's home directory and all of its contents. pw errs on the side of caution when removing files from the system. First, it will not do so if the uid of the account being removed is also used by another account on the system, and the home directory in the password file is a valid path that commences with the character “/”. Secondly, it will only remove files and directories that are actually owned by the user, or symbolic links owned by anyone under the user's home directory. Finally, after deleting all contents owned by the user only empty directories will be removed.  If any additional cleanup work is required, this is left to the Administrative user.

# pw user del username -r

If you notice that a home directory was not removed, it was for one of the reasons stated above. You should check it out to see why before completely removing the home directory.

Hosting  ::  Web Design  :: Server Administration  ::  Tech Support  ::  Contacts
Data Centers  ::  Tier I Global IP Network  ::  SLA/Contracts  ::  Search  ::  Account Login