Linux- and processing user group associated password is forgotten

A user created

1. Create a simple

useradd 用户名

2. Create a user specified directory

useradd -d 目录路径 用户名 
//注意这一类的目录路径必须写当前所在文件夹的相对路径而不能直接写目录名称

3. Specify User Group

useradd -g 用户组名 用户名

II. User modification

change Password

passwd 用户名 密码

Modify user information

usermod 命令 修改的数据 用户名
        -u  修改用户UID
        -g  修改用户GID
        -G  修改分组
        -d  修改用户家目录
        -c  修改用户备注
        -s  修改用户的所用的shell
        -L  锁定用户
        -U  解锁用户

III. Delete users

userdel 用户名Delete users, to preserve the directory
userdel -r 用户名and delete users, not to preserve the directory

注意: Under normal circumstances are reserved directory

IV. Query User

View user instructions

id 用户名
//如果用用户
//会返回uid=用户id gid=分组id 组=组名
//如果没有用
//会返回无此用户

View user file method

/etc/passwdThe user can see the last line of the file information

The meaning of each line:用户名:口令(不显示):用户id:组id:注释性描述:主目录:Shell

/etc/shadowSave user passwords and associated local time, but the password is 加密the

V. modify user groups

usermod -g 组名 用户名

VI. Packet increase

groupadd 组名

VII. Delete Group

groupdel 组名

Premise: Users in the group can not have, or can not be deleted

VIII. Packet View

Check the instruction packet

groups 查看当前登录用户的组内成员
groups gliethttp 查看gliethttp用户所在的组,以及组内成员
whoami 查看当前登录用户名

File Viewer grouping

/etc/group file

IX. User Switching

su - 用户名        切换用户
exit              返回原来用户
从高权限用户切换到低权限用户时,不需要密码

X. exit sign in

logout

XI. Forgot my password how to deal with

The premise of the machine right next to you

When start the machine pressenter

enter

img

img

img

img

And then he will automatically log in to your rootuser and password is not required, as long as you followpasswd root 新密码即可

Then restart init 6may shutdown -r nowalso bereboot

Are restarted

Guess you like

Origin www.cnblogs.com/guapitomjoy/p/12164081.html