removeuser - Deletes user accounts interactively
If you have enhanced security installed on your system, you should use
the dxaccounts command to remove users. See the Security manual and
the dxaccounts(8) reference page for more information.
The removeuser command is an interactive command for deleting user accounts
from your system. It also gives the option of deleting the user's home
directory, files and mail. The command prompts you for specific informa-
tion and informs you of its activity and error conditions.
The removeuser command invokes /usr/sbin/userdel to delete the user account
information from /etc/passwd and the hashed password database (if present).
Only the superuser can execute this command.
The command performs the following tasks:
+ Asks for a login name for the user to be deleted. Enter the login
name. If this entry does not exist in the /etc/passwd file, the com-
mand informs you of this and exits. If the entry does exist, the com-
+ Displays the entry for the user from the /etc/passwd file and asks if
this is the entry you want to delete. If the answer to this query is
no, the command indicates that the user was not deleted and then
exits. If the answer to this query is yes, the command deletes the
user's entry from the /etc/passwd file and any occurrences of the user
from the /etc/group file. It then states that the user was deleted.
+ Searches several administrative directories and files for occurrences
of the user and informs you if they exist. If so, it suggests that
you may want to delete these occurrences when the command is finished.
If no occurrences of the user are found in these directories and
files, the command indicates so.
+ Asks if you want to delete the home directory, all subdirectories, and
all mail files for the user. If the answer to this query is no, the
command indicates that the user's home directory was not deleted and
then exits. If the answer to this query is yes, the command contin-
As a precaution, the command reminds you that you should have backed
up the files for the user before removing them if you do not want to
lose them. It then asks if you are sure that you want to delete the
files for this user. If the answer to this query is no, the command
indicates that the user's home directory was not deleted and then
exits. If the answer to this query is yes, the command states that it
is removing the user's home directory, its contents and the user's
mail file. It then deletes these items.
At this point, the command ends.
Users are advised to migrate to the /usr/sbin/userdel utility or the dxac-
counts utility as this command may be removed in a future version of the
Enter a login name to be removed or <<Return>> to exit: john
This is the entry for (john) in the /etc/passwd file:
Is this the entry you want to delete (y/n)? y
Entry for (john) removed.
Searching relevant directories and files for (john) ...
Do you want to remove the home directory, all subdirectories,
files, and mail for (john) (y/n)? y
The files for (john) will be lost if not backed up.
Are you sure you want to remove these files (y/n)? y
Specifies the command path
Commands: addgroup(8), adduser(8), dxaccounts(8), finger(1), mkpasswd(8),
passwd(1), useradd(8), userdel(8), vipw(8)
Files: group(4), passwd(4)