Removes a user account.
The userdel command removes the user account identified by the login parameter. The command removes a user's attributes without removing the user's home directory by default. The user name must already exist. If the -r flag is specified, the userdel command also removes the user's home directory.
Only the root user or users with UserAdmin authorization can remove administrative users. Administrative users are those users with admin=true set in the /etc/security/user file.
Item | Description |
---|---|
-r | Removes the home directory of the user. Files located in other file systems need to be searched manually and deleted. |
-f | Forces the removal of the user account along
with the home directory and the mail spool, even if the same home
directory is accessed by another user or even if the mail spool is
not owned by the specified user. Note: This option might leave
your system in an inconsistent state.
|
Item | Description |
---|---|
0 | The command completed successfully. |
>0 | An error occurred. |
userdel davis
/usr/sbin/userdel
The userdel command has read and write permissions to the following files.
Item | Description |
---|---|
/etc/passwd | Contains the basic attributes of users. |
/etc/security/user | Contains the extended attributes of users. |
/etc/security/user.roles | Contains the administrative role attributes of users. |
/etc/security/limits | Defines resource quotas and limits for each user. |
/etc/security/environ | Contains the environment attributes of users. |
/etc/security/audit/config | Contains audit configuration information. |
/etc/security/lastlog | Contains the last login attributes of users. |
/etc/group | Contains the basic attributes of groups. |
/etc/security/group | Contains the extended attributes of groups. |