O'Reilly logo

Linux Pocket Guide, 2nd Edition by Daniel J. Barrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

usermod — stdin  stdout  - file  -- opt  --help  --version

Synopsis

usermod [options] username

The usermod command modifies the given user’s account in various ways, such as changing a home directory:

# usermod -d /home/another smith

Useful options

-d dir

Change the user’s home directory to dir.

-l username

Change the user’s login name to username. Think carefully before doing this, in case anything on your system depends on the original name. And don’t change system accounts (root, daemon, and so on) unless you really know what you’re doing!

-s shell

Change the user’s login shell to shell.

-g group

Change the user’s initial (default) group to group, which can either be a numeric group ID or a group name, and which must already exist.

-G group1,group2,...

Make the user a member only of the additional, existing groups group1, group2, and so on. If the user previously belonged to other groups, but you don’t specify them here, the user will no longer belong to them.

-L

Disable (lock) the account so the user cannot log in.

-U

Unlock the account after a lock (-L) operation.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required