[Bird Brother Linux Video tutorial finishing]04_01_linux user management commands in detail

Source: Internet
Author: User

First, user management:

1. Add User: useradd [option] USERNAME

-u:uid

-g:gid (Basic Group)

-g:gid,.. (Additional groups)

-C: "COMMENT"

-d:/path/to/somedirectory

-s:shell

-m-k:

-M:

-R: Adding system users


Environment variables:

PATH:

Histsize:

Shell:echo $SHELL

2. Delete User: Userdel [option] USERNAME

-r: Delete User's home directory at the same time

3. ID: View user's account attribute information

ID [option] USERNAME

-U:

-G:

-G:

-N:

Finger: View user account information

Finger USERNAME

Second, modify user account information:

1.usermod:

-u:uid

-g:gid

-a-g:gid does not use the-a option, overwriting the previous additional group

C:

-d-m:

-S:

-L:

-L: Lock account

-U: Unlock Account

2.chsh: Modify the user's default shell

3.CHFN: Modify annotation information


Third, password management:

passwd USERNAME

--stdin

-L:

-U:

-D: Remove user password

PWCK: Checking user account Integrity


Four, group management:

1. Create Group: Groupadd

-g:gid

-R: Added as System group

2. Modify Group: Groupmod

-g:gid

-n:grpname

3. Delete Group: Groupdel

4. Set the password for the group: GPASSWD


5.newgrp GRPNAME <--> Exit


V. Change

-D: Last modification time

-E: Expiration time

-I: Inactive time

-M: Minimum period of use

-M: Maximum lifespan

-W: Warning time


Practice:

    1. Create a user Mandriva with an ID number of 2002, a base group of distro (group ID 3003), and an additional group of Linux

#:groupadd-g 3003 distro

#:groupadd Linux

#:useradd-u 2002-g distro-g Linux Mandriva

2. Create a user fedora with the full name of Fedora Community, the default shell is tcsh

#:useradd-c "Fedora Community"-s/bin/tcsh Fedora

3. Modify Mandriva with ID 4004, Basic Group Linux, additional group distro and Fedora

#:usermod-u 4004-g linux-g Distro,fedora Mandriva

4. Add a password to Fedora and set its password to a minimum of 2 days and a maximum of 50 days

#:usermod-n 2-x Fedora

5. Change the default shell of Mandriva to/bin/bash

#:useradd-s/bin/bash Mandriva

6. Add the System user group HBase and do not allow login system

#:useradd-r-s/bin/nologin HBase


This article is from the "Linux Blind Advanced Road" blog, please be sure to keep this source http://blindbird.blog.51cto.com/12338383/1879654

[Bird Brother Linux Video tutorial finishing]04_01_linux user management commands in detail

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.