How to add a user in linux and give the user the root permission, linuxroot
1. Add a user. First, use the adduser command to add a common user. The command is as follows: # adduser tommy // Add a user named tommy # passwd tommy // change password Changing password for user tommy. new UNIX password: // enter the new password Retype New UNIX password: // enter the new password passwd: all authentication tokens updated successfully.2 again. Method 1: modify the/etc/sudoers file, find the following line, and remove the comment (#) # Allows people in group wheel to run all commands % wheel ALL = (ALL) ALL and then modify the user to make it belong to the root group (wheel). The command is as follows: # usermod-g ro After modifying ot tommy, you can log on to the system using the tommy account and run the su-command to obtain the root permission. Method 2: Modify the/etc/sudoers file, find the following line, and add a line under root, as shown below: # Allow root to run any commands anywhereroot ALL = (ALL) ALLtommy ALL = (ALL) ALL is modified. Now you can log on with the tommy account and run the su-command to obtain the root permission for the operation. Method 3: Modify the/etc/passwd file, find the following line, and change the user ID to 0, as shown below: tommy: x: 500: 500: tommy:/home/tommy: after/bin/bash is modified, save it as follows: tommy: x: 0: 500: tommy:/home/tommy:/bin/bash. After you log on to the tommy account, the root account permission is obtained directly. Friendly reminder: Although method 3 looks simple and convenient, it is generally not recommended. method 2 is recommended.