333 lines
9.3 KiB
Groff
333 lines
9.3 KiB
Groff
'\" t
|
|
.\" Title: usermod
|
|
.\" Author: Julianne Frances Haugh
|
|
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
|
|
.\" Date: 05/25/2012
|
|
.\" Manual: System Management Commands
|
|
.\" Source: shadow-utils 4.1.5.1
|
|
.\" Language: English
|
|
.\"
|
|
.TH "USERMOD" "8" "05/25/2012" "shadow\-utils 4\&.1\&.5\&.1" "System Management Commands"
|
|
.\" -----------------------------------------------------------------
|
|
.\" * Define some portability stuff
|
|
.\" -----------------------------------------------------------------
|
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
.\" http://bugs.debian.org/507673
|
|
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
.ie \n(.g .ds Aq \(aq
|
|
.el .ds Aq '
|
|
.\" -----------------------------------------------------------------
|
|
.\" * set default formatting
|
|
.\" -----------------------------------------------------------------
|
|
.\" disable hyphenation
|
|
.nh
|
|
.\" disable justification (adjust text to left margin only)
|
|
.ad l
|
|
.\" -----------------------------------------------------------------
|
|
.\" * MAIN CONTENT STARTS HERE *
|
|
.\" -----------------------------------------------------------------
|
|
.SH "NAME"
|
|
usermod \- modify a user account
|
|
.SH "SYNOPSIS"
|
|
.HP \w'\fBusermod\fR\ 'u
|
|
\fBusermod\fR [\fIoptions\fR] \fILOGIN\fR
|
|
.SH "DESCRIPTION"
|
|
.PP
|
|
The
|
|
\fBusermod\fR
|
|
command modifies the system account files to reflect the changes that are specified on the command line\&.
|
|
.SH "OPTIONS"
|
|
.PP
|
|
The options which apply to the
|
|
\fBusermod\fR
|
|
command are:
|
|
.PP
|
|
\fB\-a\fR, \fB\-\-append\fR
|
|
.RS 4
|
|
Add the user to the supplementary group(s)\&. Use only with the
|
|
\fB\-G\fR
|
|
option\&.
|
|
.RE
|
|
.PP
|
|
\fB\-c\fR, \fB\-\-comment\fR \fICOMMENT\fR
|
|
.RS 4
|
|
The new value of the user\*(Aqs password file comment field\&. It is normally modified using the
|
|
\fBchfn\fR(1)
|
|
utility\&.
|
|
.RE
|
|
.PP
|
|
\fB\-d\fR, \fB\-\-home\fR \fIHOME_DIR\fR
|
|
.RS 4
|
|
The user\*(Aqs new login directory\&.
|
|
.sp
|
|
If the
|
|
\fB\-m\fR
|
|
option is given, the contents of the current home directory will be moved to the new home directory, which is created if it does not already exist\&.
|
|
.RE
|
|
.PP
|
|
\fB\-e\fR, \fB\-\-expiredate\fR \fIEXPIRE_DATE\fR
|
|
.RS 4
|
|
The date on which the user account will be disabled\&. The date is specified in the format
|
|
\fIYYYY\-MM\-DD\fR\&.
|
|
.sp
|
|
An empty
|
|
\fIEXPIRE_DATE\fR
|
|
argument will disable the expiration of the account\&.
|
|
.sp
|
|
This option requires a
|
|
/etc/shadow
|
|
file\&. A
|
|
/etc/shadow
|
|
entry will be created if there were none\&.
|
|
.RE
|
|
.PP
|
|
\fB\-f\fR, \fB\-\-inactive\fR \fIINACTIVE\fR
|
|
.RS 4
|
|
The number of days after a password expires until the account is permanently disabled\&.
|
|
.sp
|
|
A value of 0 disables the account as soon as the password has expired, and a value of \-1 disables the feature\&.
|
|
.sp
|
|
This option requires a
|
|
/etc/shadow
|
|
file\&. A
|
|
/etc/shadow
|
|
entry will be created if there were none\&.
|
|
.RE
|
|
.PP
|
|
\fB\-g\fR, \fB\-\-gid\fR \fIGROUP\fR
|
|
.RS 4
|
|
The group name or number of the user\*(Aqs new initial login group\&. The group must exist\&.
|
|
.sp
|
|
Any file from the user\*(Aqs home directory owned by the previous primary group of the user will be owned by this new group\&.
|
|
.sp
|
|
The group ownership of files outside of the user\*(Aqs home directory must be fixed manually\&.
|
|
.RE
|
|
.PP
|
|
\fB\-G\fR, \fB\-\-groups\fR \fIGROUP1\fR[\fI,GROUP2,\&.\&.\&.\fR[\fI,GROUPN\fR]]]
|
|
.RS 4
|
|
A list of supplementary groups which the user is also a member of\&. Each group is separated from the next by a comma, with no intervening whitespace\&. The groups are subject to the same restrictions as the group given with the
|
|
\fB\-g\fR
|
|
option\&.
|
|
.sp
|
|
If the user is currently a member of a group which is not listed, the user will be removed from the group\&. This behaviour can be changed via the
|
|
\fB\-a\fR
|
|
option, which appends the user to the current supplementary group list\&.
|
|
.RE
|
|
.PP
|
|
\fB\-l\fR, \fB\-\-login\fR \fINEW_LOGIN\fR
|
|
.RS 4
|
|
The name of the user will be changed from
|
|
\fILOGIN\fR
|
|
to
|
|
\fINEW_LOGIN\fR\&. Nothing else is changed\&. In particular, the user\*(Aqs home directory or mail spool should probably be renamed manually to reflect the new login name\&.
|
|
.RE
|
|
.PP
|
|
\fB\-L\fR, \fB\-\-lock\fR
|
|
.RS 4
|
|
Lock a user\*(Aqs password\&. This puts a \*(Aq!\*(Aq in front of the encrypted password, effectively disabling the password\&. You can\*(Aqt use this option with
|
|
\fB\-p\fR
|
|
or
|
|
\fB\-U\fR\&.
|
|
.sp
|
|
Note: if you wish to lock the account (not only access with a password), you should also set the
|
|
\fIEXPIRE_DATE\fR
|
|
to
|
|
\fI1\fR\&.
|
|
.RE
|
|
.PP
|
|
\fB\-m\fR, \fB\-\-move\-home\fR
|
|
.RS 4
|
|
Move the content of the user\*(Aqs home directory to the new location\&.
|
|
.sp
|
|
This option is only valid in combination with the
|
|
\fB\-d\fR
|
|
(or
|
|
\fB\-\-home\fR) option\&.
|
|
.sp
|
|
|
|
\fBusermod\fR
|
|
will try to adapt the ownership of the files and to copy the modes, ACL and extended attributes, but manual changes might be needed afterwards\&.
|
|
.RE
|
|
.PP
|
|
\fB\-o\fR, \fB\-\-non\-unique\fR
|
|
.RS 4
|
|
When used with the
|
|
\fB\-u\fR
|
|
option, this option allows to change the user ID to a non\-unique value\&.
|
|
.RE
|
|
.PP
|
|
\fB\-p\fR, \fB\-\-password\fR \fIPASSWORD\fR
|
|
.RS 4
|
|
The encrypted password, as returned by
|
|
\fBcrypt\fR(3)\&.
|
|
.sp
|
|
|
|
\fBNote:\fR
|
|
This option is not recommended because the password (or encrypted password) will be visible by users listing the processes\&.
|
|
.sp
|
|
You should make sure the password respects the system\*(Aqs password policy\&.
|
|
.RE
|
|
.PP
|
|
\fB\-R\fR, \fB\-\-root\fR \fICHROOT_DIR\fR
|
|
.RS 4
|
|
Apply changes in the
|
|
\fICHROOT_DIR\fR
|
|
directory and use the configuration files from the
|
|
\fICHROOT_DIR\fR
|
|
directory\&.
|
|
.RE
|
|
.PP
|
|
\fB\-s\fR, \fB\-\-shell\fR \fISHELL\fR
|
|
.RS 4
|
|
The name of the user\*(Aqs new login shell\&. Setting this field to blank causes the system to select the default login shell\&.
|
|
.RE
|
|
.PP
|
|
\fB\-u\fR, \fB\-\-uid\fR \fIUID\fR
|
|
.RS 4
|
|
The new numerical value of the user\*(Aqs ID\&.
|
|
.sp
|
|
This value must be unique, unless the
|
|
\fB\-o\fR
|
|
option is used\&. The value must be non\-negative\&.
|
|
.sp
|
|
The user\*(Aqs mailbox, and any files which the user owns and which are located in the user\*(Aqs home directory will have the file user ID changed automatically\&.
|
|
.sp
|
|
The ownership of files outside of the user\*(Aqs home directory must be fixed manually\&.
|
|
.sp
|
|
No checks will be performed with regard to the
|
|
\fBUID_MIN\fR,
|
|
\fBUID_MAX\fR,
|
|
\fBSYS_UID_MIN\fR, or
|
|
\fBSYS_UID_MAX\fR
|
|
from
|
|
/etc/login\&.defs\&.
|
|
.RE
|
|
.PP
|
|
\fB\-U\fR, \fB\-\-unlock\fR
|
|
.RS 4
|
|
Unlock a user\*(Aqs password\&. This removes the \*(Aq!\*(Aq in front of the encrypted password\&. You can\*(Aqt use this option with
|
|
\fB\-p\fR
|
|
or
|
|
\fB\-L\fR\&.
|
|
.sp
|
|
Note: if you wish to unlock the account (not only access with a password), you should also set the
|
|
\fIEXPIRE_DATE\fR
|
|
(for example to
|
|
\fI99999\fR, or to the
|
|
\fBEXPIRE\fR
|
|
value from
|
|
/etc/default/useradd)\&.
|
|
.RE
|
|
.PP
|
|
\fB\-Z\fR, \fB\-\-selinux\-user\fR \fISEUSER\fR
|
|
.RS 4
|
|
The new SELinux user for the user\*(Aqs login\&.
|
|
.sp
|
|
A blank
|
|
\fISEUSER\fR
|
|
will remove the SELinux user mapping for user
|
|
\fILOGIN\fR
|
|
(if any)\&.
|
|
.RE
|
|
.SH "CAVEATS"
|
|
.PP
|
|
You must make certain that the named user is not executing any processes when this command is being executed if the user\*(Aqs numerical user ID, the user\*(Aqs name, or the user\*(Aqs home directory is being changed\&.
|
|
\fBusermod\fR
|
|
checks this on Linux, but only check if the user is logged in according to utmp on other architectures\&.
|
|
.PP
|
|
You must change the owner of any
|
|
\fBcrontab\fR
|
|
files or
|
|
\fBat\fR
|
|
jobs manually\&.
|
|
.PP
|
|
You must make any changes involving NIS on the NIS server\&.
|
|
.SH "CONFIGURATION"
|
|
.PP
|
|
The following configuration variables in
|
|
/etc/login\&.defs
|
|
change the behavior of this tool:
|
|
.PP
|
|
\fBMAIL_DIR\fR (string)
|
|
.RS 4
|
|
The mail spool directory\&. This is needed to manipulate the mailbox when its corresponding user account is modified or deleted\&. If not specified, a compile\-time default is used\&.
|
|
.RE
|
|
.PP
|
|
\fBMAIL_FILE\fR (string)
|
|
.RS 4
|
|
Defines the location of the users mail spool files relatively to their home directory\&.
|
|
.RE
|
|
.PP
|
|
The
|
|
\fBMAIL_DIR\fR
|
|
and
|
|
\fBMAIL_FILE\fR
|
|
variables are used by
|
|
\fBuseradd\fR,
|
|
\fBusermod\fR, and
|
|
\fBuserdel\fR
|
|
to create, move, or delete the user\*(Aqs mail spool\&.
|
|
.PP
|
|
If
|
|
\fBMAIL_CHECK_ENAB\fR
|
|
is set to
|
|
\fIyes\fR, they are also used to define the
|
|
\fBMAIL\fR
|
|
environment variable\&.
|
|
.PP
|
|
\fBMAX_MEMBERS_PER_GROUP\fR (number)
|
|
.RS 4
|
|
Maximum members per group entry\&. When the maximum is reached, a new group entry (line) is started in
|
|
/etc/group
|
|
(with the same name, same password, and same GID)\&.
|
|
.sp
|
|
The default value is 0, meaning that there are no limits in the number of members in a group\&.
|
|
.sp
|
|
This feature (split group) permits to limit the length of lines in the group file\&. This is useful to make sure that lines for NIS groups are not larger than 1024 characters\&.
|
|
.sp
|
|
If you need to enforce such limit, you can use 25\&.
|
|
.sp
|
|
Note: split groups may not be supported by all tools (even in the Shadow toolsuite)\&. You should not use this variable unless you really need it\&.
|
|
.RE
|
|
.SH "FILES"
|
|
.PP
|
|
/etc/group
|
|
.RS 4
|
|
Group account information\&.
|
|
.RE
|
|
.PP
|
|
/etc/gshadow
|
|
.RS 4
|
|
Secure group account information\&.
|
|
.RE
|
|
.PP
|
|
/etc/login\&.defs
|
|
.RS 4
|
|
Shadow password suite configuration\&.
|
|
.RE
|
|
.PP
|
|
/etc/passwd
|
|
.RS 4
|
|
User account information\&.
|
|
.RE
|
|
.PP
|
|
/etc/shadow
|
|
.RS 4
|
|
Secure user account information\&.
|
|
.RE
|
|
.SH "SEE ALSO"
|
|
.PP
|
|
|
|
\fBchfn\fR(1),
|
|
\fBchsh\fR(1),
|
|
\fBpasswd\fR(1),
|
|
\fBcrypt\fR(3),
|
|
\fBgpasswd\fR(8),
|
|
\fBgroupadd\fR(8),
|
|
\fBgroupdel\fR(8),
|
|
\fBgroupmod\fR(8),
|
|
\fBlogin.defs\fR(5),
|
|
\fBuseradd\fR(8),
|
|
\fBuserdel\fR(8)\&.
|