Linux Learning Notes (12) Usermod, passwd, mkpasswd

Source: Internet
Author: User

First, usermod modify user information

Usermod-u 111 username #修改用户usermod-G grp2 username #修改用户组usermod-D/home/chinantfy2 username #修改用户家 Catalog Usermod-s/sbin/nologin Username #修改用户shell

A user can belong to multiple groups, but GID has only one

ID username can view user uid with GID and owning group

Usermod-g only one group can be modified
Usermod-g can add multiple groups, with this command followed by several groups, the owning group of the file is the specified group plus the group to which the user was originally built, such as Usermod-g Grp1,user2 Username assumes that the group is USERGRP when the account is established, then the user group is Usergrp,grp1,user2

Second, passwd

passwd can modify the user password, the root user can modify the password of all users, ordinary users can only modify their own password;

Passwd-l username

Can lock the user password, at this time the user can not login, when the cat Etc/shadow to see, password location changed! Beginning

Passwd-u username

Unlock password

Other than that

USERMOD-L username Lock User Password

Usermod-u username Unlocking user

commands to change passwords directly

echo "111222aaa" |passwd--stdin usr2echo-e "111222aaa\n111222aaa\n" |passwd USR2

Iii. mkpasswd Order

Yum Install-y expect

Install packages

mkpasswd

Complex passwords can be generated randomly, default nine-bit

Mkpasswd-l 12

Then specify a password length of 12 bits

-s Specifies the number of special symbols



Linux Learning Notes (12) Usermod, passwd, mkpasswd

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.