1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh
SPDX-FileCopyrightText: 2007 - 2011, Nicolas François
SPDX-License-Identifier: BSD-3-Clause
-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY LASTLOG_UID_MAX SYSTEM "login.defs.d/LASTLOG_UID_MAX.xml">
<!ENTITY MAIL_DIR SYSTEM "login.defs.d/MAIL_DIR.xml">
<!ENTITY MAX_MEMBERS_PER_GROUP SYSTEM "login.defs.d/MAX_MEMBERS_PER_GROUP.xml">
<!ENTITY SUB_GID_COUNT SYSTEM "login.defs.d/SUB_GID_COUNT.xml">
<!ENTITY SUB_UID_COUNT SYSTEM "login.defs.d/SUB_UID_COUNT.xml">
<!ENTITY TCB_SYMLINKS SYSTEM "login.defs.d/TCB_SYMLINKS.xml">
<!ENTITY USE_TCB SYSTEM "login.defs.d/USE_TCB.xml">
<!-- SHADOW-CONFIG-HERE -->
]>
<refentry id='usermod.8'>
<!-- $Id$ -->
<refentryinfo>
<author>
<firstname>Julianne Frances</firstname>
<surname>Haugh</surname>
<contrib>Creation, 1991</contrib>
</author>
<author>
<firstname>Thomas</firstname>
<surname>Kłoczko</surname>
<email>kloczek@pld.org.pl</email>
<contrib>shadow-utils maintainer, 2000 - 2007</contrib>
</author>
<author>
<firstname>Nicolas</firstname>
<surname>François</surname>
<email>nicolas.francois@centraliens.net</email>
<contrib>shadow-utils maintainer, 2007 - now</contrib>
</author>
</refentryinfo>
<refmeta>
<refentrytitle>usermod</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo class="sectdesc">System Management Commands</refmiscinfo>
<refmiscinfo class="source">shadow-utils</refmiscinfo>
<refmiscinfo class="version">&SHADOW_UTILS_VERSION;</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>usermod</refname>
<refpurpose>modify a user account</refpurpose>
</refnamediv>
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
<command>usermod</command>
<arg choice='opt'>
<replaceable>options</replaceable>
</arg>
<arg choice='plain'><replaceable>LOGIN</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id='description'>
<title>DESCRIPTION</title>
<para>
The <command>usermod</command> command modifies the system account
files.
</para>
</refsect1>
<refsect1 id='options'>
<title>OPTIONS</title>
<para>
The options which apply to the <command>usermod</command> command
are:
</para>
<variablelist>
<varlistentry>
<term>
<option>-a</option>, <option>--append</option>
</term>
<listitem>
<para>
Add the user to the supplementary group(s). Use only with the
<option>-G</option> option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-b</option>, <option>--badname</option>
</term>
<listitem>
<para>
Allow names that do not conform to standards.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-c</option>, <option>--comment</option> <replaceable>COMMENT</replaceable>
</term>
<listitem>
<para>
update the comment field of the user in <filename>/etc/passwd
</filename>, which is normally modified using the <citerefentry>
<refentrytitle>chfn</refentrytitle><manvolnum>1</manvolnum>
</citerefentry> utility.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-d</option>, <option>--home</option> <replaceable>HOME_DIR</replaceable>
</term>
<listitem>
<para>
The user's new login directory.
</para>
<para>
If the <option>-m</option>
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. If the current home directory does not exist
the new home directory will not be created.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-e</option>, <option>--expiredate</option> <replaceable>EXPIRE_DATE</replaceable>
</term>
<listitem>
<para>
Specifies the date on which the user account will be disabled.
The value can be specified as a date in the YYYY-MM-DD format
or as a number of days since 1970-01-01.
The date is interpreted using the UTC timezone.
</para>
<para>
An input of -1 or an empty string blanks the account expiration field
in the shadow password file.
The account will remain available with no expiration date.
</para>
<para>
This option requires the <filename>/etc/shadow</filename> file.
If no entry exists in the <filename>/etc/shadow</filename> file,
the system will automatically create one.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-f</option>, <option>--inactive</option> <replaceable>INACTIVE</replaceable>
</term>
<listitem>
<para>
Defines the number of days after a password exceeds its maximum age
during which the user can still log in by immediately changing their password.
If the user does not change their password within this period of time,
their account becomes inactive.
This value is stored in the shadow password file.
</para>
<para>
A value of 0 disables the account when the password expires, with no delay.
</para>
<para>
A value of -1 empties the respective field in the shadow password file,
which means that the inactivity period is not enforced.
</para>
<para>
This option requires the <filename>/etc/shadow</filename> file.
If no entry exist in the <filename>/etc/shadow</filename> file,
the system will automatically create one.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-g</option>, <option>--gid</option> <replaceable>GROUP</replaceable>
</term>
<listitem>
<para>
The name or numerical ID of the user's new primary group.
The group must exist.
</para>
<para>
Any file from the user's home directory owned by the previous
primary group of the user will be owned by this new group.
</para>
<para>
The group ownership of files outside of the user's home directory
must be fixed manually.
</para>
<para>
The change of the group ownership of files inside of the user's
home directory is also not done if the home dir owner uid is
different from the current or new user id. This is a safety measure
for special home directories such as <filename>/</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-G</option>, <option>--groups</option> <replaceable>GROUP1</replaceable>[<emphasis remap='I'>,GROUP2,...</emphasis>[<emphasis remap='I'>,GROUPN</emphasis>]]]
</term>
<listitem>
<para>
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 must exist.
</para>
<para>
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 <option>-a</option> option, which
appends the user to the current supplementary group list.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-l</option>, <option>--login</option> <replaceable>NEW_LOGIN</replaceable>
</term>
<listitem>
<para>
The name of the user will be changed from
<replaceable>LOGIN</replaceable> to
<replaceable>NEW_LOGIN</replaceable>. Nothing else is changed. In
particular, the user's home directory or mail spool should
probably be renamed manually to reflect the new login name.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-L</option>, <option>--lock</option>
</term>
<listitem>
<para>
Lock a user's password. This puts a '!' in front of the
encrypted password, effectively disabling the password. You
can't use this option with <option>-p</option> or
<option>-U</option>.
</para>
<para>
Note: if you wish to lock the account (not only access with a
password), you should also set the
<replaceable>EXPIRE_DATE</replaceable> to
<replaceable>1</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-m</option>, <option>--move-home</option>
</term>
<listitem>
<para>
moves the content of the user's home directory to the new
location. If the current home directory does not exist
the new home directory will not be created.
</para>
<para>
This option is only valid in combination with the
<option>-d</option> (or <option>--home</option>) option.
</para>
<para>
<command>usermod</command> 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.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-o</option>, <option>--non-unique</option>
</term>
<listitem>
<para>
allows to change the user ID to a non-unique value.
</para>
<para>
This option is only valid in combination with the
<option>-u</option> option. As a user identity
serves as
key to map between users on one hand and permissions, file
ownerships and other aspects that determine the system's
behavior on the other hand, more than one login name
will access the account of the given UID.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-p</option>, <option>--password</option> <replaceable>PASSWORD</replaceable>
</term>
<listitem>
<para>
defines a new password for the user. PASSWORD is expected to
be encrypted, as returned by <citerefentry><refentrytitle>crypt
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>
<para>
<emphasis role="bold">Note:</emphasis> Avoid this option on the
command line because the password (or encrypted password) will
be visible by users listing the processes.
</para>
<para condition="pam">
The password will be written in the local
<filename>/etc/passwd</filename> or
<filename>/etc/shadow</filename> file. This might differ from the
password database configured in your PAM configuration.
</para>
<para>
You should make sure the password respects the system's
password policy.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-r</option>, <option>--remove</option>
</term>
<listitem>
<para>
Remove the user from named supplementary group(s). Use only with the
<option>-G</option> option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-R</option>, <option>--root</option> <replaceable>CHROOT_DIR</replaceable>
</term>
<listitem>
<para>
Apply changes in the <replaceable>CHROOT_DIR</replaceable>
directory and use the configuration files from the
<replaceable>CHROOT_DIR</replaceable> directory.
Only absolute paths are supported.
No SELINUX support.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-P</option>, <option>--prefix</option> <replaceable>PREFIX_DIR</replaceable>
</term>
<listitem>
<para>
Apply changes within the directory tree starting with
<replaceable>PREFIX_DIR</replaceable> and use as well the
configuration files located there. This option does not
chroot and is intended for preparing a cross-compilation
target. Some limitations: NIS and LDAP users/groups are
not verified. PAM authentication is using the host
files. No SELINUX support.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-s</option>, <option>--shell</option> <replaceable>SHELL</replaceable>
</term>
<listitem>
<para>
changes the user's login shell. An empty string for SHELL empties the
field in <filename>/etc/passwd</filename> and logs the user into the
system's default shell.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-u</option>, <option>--uid</option> <replaceable>UID</replaceable>
</term>
<listitem>
<para>
The new value of the user's ID.
</para>
<para>
This value must be unique,
unless the <option>-o</option> option is used. The value must be
non-negative.
</para>
<para>
The user's mailbox, and any files which the user owns and which are
located in the user's home
directory will have the file user ID changed automatically.
</para>
<para>
The ownership of files outside of the user's home directory
must be fixed manually.
</para>
<para>
The change of the user ownership of files inside of the user's
home directory is also not done if the home dir owner uid is
different from the current or new user id. This is a safety measure
for special home directories such as <filename>/</filename>.
</para>
<para>
No checks will be performed with regard to the
<option>UID_MIN</option>, <option>UID_MAX</option>,
<option>SYS_UID_MIN</option>, or <option>SYS_UID_MAX</option>
from <filename>/etc/login.defs</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-U</option>, <option>--unlock</option>
</term>
<listitem>
<para>
Unlock a user's password. This removes the '!' in front of the
encrypted password. You can't use this option with
<option>-p</option> or <option>-L</option>.
</para>
<para>
Note: if you wish to unlock the account (not only access with a
password), you should also set the
<replaceable>EXPIRE_DATE</replaceable> (for example to
<replaceable>99999</replaceable>, or to the
<option>EXPIRE</option> value from
<filename>/etc/default/useradd</filename>).
</para>
</listitem>
</varlistentry>
<varlistentry condition="subids">
<term>
<option>-v</option>, <option>--add-subuids</option> <replaceable>FIRST</replaceable>-<replaceable>LAST</replaceable>
</term>
<listitem>
<para>
Add a range of subordinate uids to the user's account.
</para>
<para>
This option may be specified multiple times to add multiple ranges to a user's account.
</para>
<para>
No checks will be performed with regard to
<option>SUB_UID_MIN</option>, <option>SUB_UID_MAX</option>, or
<option>SUB_UID_COUNT</option> from /etc/login.defs.
</para>
</listitem>
</varlistentry>
<varlistentry condition="subids">
<term>
<option>-V</option>, <option>--del-subuids</option> <replaceable>FIRST</replaceable>-<replaceable>LAST</replaceable>
</term>
<listitem>
<para>
Remove a range of subordinate uids from the user's account.
</para>
<para>
This option may be specified multiple times to remove multiple ranges to a user's account.
When both <option>--del-subuids</option> and <option>--add-subuids</option> are specified,
the removal of all subordinate uid ranges happens before any subordinate uid range is added.
</para>
<para>
No checks will be performed with regard to
<option>SUB_UID_MIN</option>, <option>SUB_UID_MAX</option>, or
<option>SUB_UID_COUNT</option> from /etc/login.defs.
</para>
</listitem>
</varlistentry>
<varlistentry condition="subids">
<term>
<option>-w</option>, <option>--add-subgids</option> <replaceable>FIRST</replaceable>-<replaceable>LAST</replaceable>
</term>
<listitem>
<para>
Add a range of subordinate gids to the user's account.
</para>
<para>
This option may be specified multiple times to add multiple ranges to a user's account.
</para>
<para>
No checks will be performed with regard to
<option>SUB_GID_MIN</option>, <option>SUB_GID_MAX</option>, or
<option>SUB_GID_COUNT</option> from /etc/login.defs.
</para>
</listitem>
</varlistentry>
<varlistentry condition="subids">
<term>
<option>-W</option>, <option>--del-subgids</option> <replaceable>FIRST</replaceable>-<replaceable>LAST</replaceable>
</term>
<listitem>
<para>
Remove a range of subordinate gids from the user's account.
</para>
<para>
This option may be specified multiple times to remove multiple ranges to a user's account.
When both <option>--del-subgids</option> and <option>--add-subgids</option> are specified,
the removal of all subordinate gid ranges happens before any subordinate gid range is added.
</para>
<para>
No checks will be performed with regard to
<option>SUB_GID_MIN</option>, <option>SUB_GID_MAX</option>, or
<option>SUB_GID_COUNT</option> from /etc/login.defs.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-Z</option>, <option>--selinux-user</option> <replaceable>SEUSER</replaceable>
</term>
<listitem>
<para>
defines the SELinux user to be mapped with
<replaceable>LOGIN</replaceable>. An empty string ("")
will remove the respective entry (if any). Note that the
shadow system doesn't store the selinux-user, it uses
semanage(8) for that.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--selinux-range</option> <replaceable>SERANGE</replaceable>
</term>
<listitem>
<para>
defines the SELinux MLS range for the new account.
Note that the shadow system doesn't store the selinux-range,
it uses <citerefentry><refentrytitle>semanage</refentrytitle>
<manvolnum>8</manvolnum></citerefentry> for that.
</para>
<para>
This option is only valid if the <option>-Z</option> (or
<option>--selinux-user</option>) option is specified.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='caveats'>
<title>CAVEATS</title>
<para>
You must make certain that the named user is
not executing any processes when this command is being executed if the
user's numerical user ID, the user's name, or the user's home
directory is being changed. <command>usermod</command> checks this
on Linux. On other operating systems it only uses utmp to check if
the user is logged in.
</para>
<para>
You must change the owner of any <command>crontab</command> files or
<command>at</command> jobs manually.
</para>
<para>
You must make any changes involving NIS on the NIS server.
</para>
</refsect1>
<refsect1 id='configuration'>
<title>CONFIGURATION</title>
<para>
The following configuration variables in
<filename>/etc/login.defs</filename> change the behavior of this
tool:
</para>
<variablelist>
&LASTLOG_UID_MAX;
&MAIL_DIR; <!-- documents also MAIL_FILE -->
&MAX_MEMBERS_PER_GROUP;
&SUB_GID_COUNT; <!-- documents also SUB_GID_MAX and SUB_GID_MIN -->
&SUB_UID_COUNT; <!-- documents also SUB_UID_MAX and SUB_UID_MIN -->
&TCB_SYMLINKS;
&USE_TCB;
</variablelist>
</refsect1>
<refsect1 id='files'>
<title>FILES</title>
<variablelist>
<varlistentry>
<term><filename>/etc/group</filename></term>
<listitem>
<para>Group account information</para>
</listitem>
</varlistentry>
<varlistentry condition="gshadow">
<term><filename>/etc/gshadow</filename></term>
<listitem>
<para>Secure group account information</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>/etc/login.defs</filename></term>
<listitem>
<para>Shadow password suite configuration</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>/etc/passwd</filename></term>
<listitem>
<para>User account information</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>/etc/shadow</filename></term>
<listitem>
<para>Secure user account information</para>
</listitem>
</varlistentry>
<varlistentry condition="subids">
<term><filename>/etc/subgid</filename></term>
<listitem>
<para>Per user subordinate group IDs</para>
</listitem>
</varlistentry>
<varlistentry condition="subids">
<term><filename>/etc/subuid</filename></term>
<listitem>
<para>Per user subordinate user IDs</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='see_also'>
<title>SEE ALSO</title>
<para>
<citerefentry>
<refentrytitle>chfn</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>chsh</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>passwd</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>gpasswd</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>groupadd</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>groupdel</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>groupmod</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>login.defs</refentrytitle><manvolnum>5</manvolnum>
</citerefentry>,
<phrase condition="subids">
<citerefentry>
<refentrytitle>subgid</refentrytitle><manvolnum>5</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>subuid</refentrytitle><manvolnum>5</manvolnum>
</citerefentry>,
</phrase>
<citerefentry>
<refentrytitle>useradd</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>userdel</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>.
</para>
</refsect1>
</refentry>
|