Add user and give root privileges

usergroup wen
useradd wen -g wen
passwd wen
New UNIX password: //Enter the new password here
Retype new UNIX password: //Enter the new password again
passwd: all authentication tokens updated successfully.


2. Give root privileges to

/etc/sudoers Read-only, you can use the wq! command to force the save under the root user

Method 1: Modify the /etc/sudoers file, find the following line, and remove the previous comment (#)

## Allows people in group wheel to run all commands
%wheel ALL= (ALL) ALL

Then modify the user so that it belongs to the root group (wheel), the command is as follows:

#usermod -g root tommy

After the modification, you can now log in with the tommy account, and then use the command su - to obtain root privileges to operate.

Method 2: Modify the /etc/sudoers file, find the following line, and add a line below root, as shown below:

## Allow root to run any commands anywhere
root ALL=(ALL) ALL
tommy ALL=(ALL) ALL

After the modification is completed, you can now log in with the tommy account, and then use the command sudo - to obtain root privileges to operate.

Method 3: Modify the /etc/passwd file, find the following line, and change the user ID to 0, as shown below:
tommy:x:0:33:tommy:/data/webroot:/bin/bash

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326269474&siteId=291194637