Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > U


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


userdel — delete a user login from the system


userdel [-r] [-F] [-P -S alternate_password_file] login


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).


userdel recognizes the following options:


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.

If a user is deleted and the home directory is shared by others, then this directory is not deleted even with the -r option.


Force the changes, even if the login is currently in use.


Specify that the changes are being made to the alternate password file of NIS specified by the -S option. The -r and -F options should not be used with this option.

-S alternate_password_file

Specify the path of the alternate password file of NIS. The -P option is used with the -S option.

In the event where a directory is shared by users of the same group and the owner of that directory is deleted, then the ownership of that directory is propagated to the next user who is sharing that directory. The new owner is determined by looking at the order in which the users sharing this directory are added to the /etc/passwd file. If there is only one user remaining then the directory is brought back to unshared mode by resetting the permissions to 755 from 775.


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 modified

(return value 10) is returned if a local user belongs to an NIS group (see group(4)).


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.


userdel exits with one of the following values:


Successful completion.


Invalid command syntax.


Invalid argument supplied to an option.


The login to be removed does not exist.


The login to be removed is in use.


Cannot modify the /etc/group file, but the login was removed from the /etc/passwd file.


Unable to remove or modify the home directory.


Unable to open /etc/ptmp file or /etc/passwd file is non-existent.


/etc/passwd file or /etc/ptmp file busy. Another command may be modifying the /etc/passwd file.


Cannot delete entry from /etc/passwd file.


Out of memory.


Invalid template file.


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


Because many users may try to write the /etc/passwd file simultaneously, a password locking mechanism was devised. If this locking fails after subsequent retrying, userdel terminates.



Shadow Password file


System Password file


System group file


Lock file used when updating password file


userdel: SVID3

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.