userdel(1M)
NAME
userdel − delete a user login from the system
SYNOPSIS
userdel [-r] login
DESCRIPTION
The userdel command deletes a user login from the system by modifying the appropriate login related files.
The userdel command requires the login argument. login is the name to be deleted, specified as a string of printable characters. It may not contain a colon (:) or a newline (\n).
Option
The following option is available to this command:
-r The home directory of login is removed from the system. This directory must exist. Following the successful execution of this command, none of the files and directories under the home directory will be available.
NETWORKING FEATURES
NIS
This command is aware of NIS user and group entries. Only local users and groups may be deleted or modified with this command. Attempts to delete or modify NIS users or groups will result in an error. NIS users and groups must be administered from the NIS server. The userdel command may fail with the error
login x does not exist
(return value 6) if the user specified is an NIS user (see passwd(4)). The error
Cannot modify /etc/group file, /etc/passwd was
(return value 10) is returned if a local user belongs to an NIS group (see group(4)).
NFS
Errors may occur with the -r option if the affected directory is within an NFS mounted file system that does not allow root privileges across the NFS mount, and the directory or files within the directory do not have sufficient permissions.
RETURN VALUES
userdel exits with one of the following values:
0 Successful completion.
2 Invalid command syntax.
3 Invalid argument supplied to an option.
6 The login to be removed does not exist.
8 The login to be removed is in use.
10 Cannot modify the /etc/group file, but the login was removed from the /etc/passwd file.
12 Unable to remove or modify the home directory.
13 Unable to open /etc/ptmp file or /etc/passwd file is non-existent.
14 /etc/passwd file or /etc/ptmp file busy. Another command may be modifying the /etc/passwd file.
17 Cannot delete entry from /etc/passwd file.
EXAMPLES
Remove the user otto from the system:
userdel otto
Remove the user bob from the system and delete bob’s home directory from the system:
userdel -r bob
WARNINGS
As many users may try to write the /etc/passwd file simultaneously, a passwd locking mechanism was deviced. If this locking fails after subsequent retrying, userdel terminates.
FILES
/etc/passwd
/etc/group
/etc/ptmp
SEE ALSO
passwd(1), users(1), groupadd(1M), groupdel(1M), groupmod(1M), logins(1M), passwd(1M), useradd(1M), usermod(1M), group(4).
STANDARDS COMPLIANCE
userdel: SVID3
Hewlett-Packard Company — HP-UX Release 10.20: July 1996