How to use User management and group management commands for Linux users

Source: Internet
Author: User
Tags file copy stdin

Useradd[options] USERNAME

- u UID Specify user ID , greater than -

- G GID ( Basic Group ), group must exist

- G GID , ...,... ( Additional group, can have multiple )

- C "COMMENT" Comment Information

- D /path/to/somedirectory Specify home directory

                      -s/bin/bash  specify shell path   SHELL environment variable ECHO $ SHELL

-m-k ( file copy in/etc/skel/to the home directory created ) force a home directory for users

ls-a/etc/skel/ Show hidden files

- M do not create home directory /etc/login.defs

- R system users, can not log on to the system, no home directory. 1-400

Environment variables:

PATH

SHELL

Histsize

Userdel: Delete User

Userdel[option] USERNAME , if you do not specify any options, the user's home directory will not be deleted '

- R: Delete a user's home directory while deleting it

ID : View the user's account attribute information.

-U user

-G Group

- G Additional groups

- N Display Name

Fingerusername need to install

the function of the Linuxfinger command is to query the user's information, typically displaying the user name, home directory, stasis time, logon time, logon Shell and other information. If you want to query the user information on the remote computer, you need to follow the user name "@ hostname", the [username @ hostname] format, but to query the network host needs to run the finger daemon.

Modify user account attribute information option with the Useradd similar

usermod [Options] USERNAME

- u Modify User ID

- G Pre-existing groups when needed   

- G previous additional groups will be overwritten. -a-g Append additional group, do not overwrite.

-C

-d-m Move the previous file to the new home directory.

-S

- L Modify LoginName

- L lock Account, disable

- u Unlock account

Chsh : Modify the user's default Shell

CHFN : Modify User's comment information

Password Management: passwd [USERNAME] administrators can modify other users ' information

--stdin: read password from standard input

Echo "Redhat" |passwd--stdin user3 Piping Create user account in script, set password

-L Lock

-U unlock

-D Delete Tail/etc/shadow

Pam

Pwck Check the integrity of user accounts

chage Modify user Password expiry time Manchage

Group Management:

Groupadd

-G GID

- R Add a system group group-r Apache Tail-1/etc/group

Groupmod

-G GID

- u Group name

Groupdelusername

gpasswd USERNAME add a password to a group

The owner of the user-created object is the basic group that the user belongs to touch ahead

Newgrp Switch to the new base group and need to log in to exit with a password


This article is from the "7489131" blog, please be sure to keep this source http://7499131.blog.51cto.com/7489131/1703871

How to use User management and group management commands for Linux users

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.