Linux add users and give root privileges

New users

Create a file called qiang, which is located in the user's home directory / usr / qiang's

adduser -d /usr/qiang -m qiang

Directly or so, the default user's home directory is / home / directory

adduser qiang

User password initialization

passwd qiang

Giving root privileges

Modify the file / etc / passwd, the user name of the user ID qiang to modify 0

vi /etc/passwd

User information qiang:x:1002:1002::/home/qiang:/bin/bash, change it toqiang:x:0:1002::/home/qiang:/bin/bash

View all user information

Each line represents a user information

cat /etc/passwd

Representing Username: Password: User ID: User Group ID: NOTE: The user's home directory: shell command directory

View all user groups

/etc/group

Guess you like

Origin www.cnblogs.com/lukefan/p/11127852.html