If you run the sudo command under a common user, the prompt xxx is not in the sudoers file. This incident will be reported. solution: $ Whereis sudoers ------- locate the file location, which is/etc/sudoers by default Sometimes we only need to execute a command with the root permission to su to the root, isn't it inconvenient? In this case, sudo can be used instead. By default, the new user is not in The sudo group. You need to edit the/etc/sudoers file to add the user. The file can only use the mongodo command, First, you need to switch to root and su-(note that there are-, which is different from su. When you use the "su" command, you only need to switch to root, however, if the root environment variable is not passed, it is still the currently used environment variable. The "su-" command is used to bring the environment variable together, just like the root login ). Then mongodo or vim/etc/sudoers, and mongodo are used in the same way as vi. Move the cursor to the next line of root ALL = (ALL) ALL and enter your_user_name ALL = (ALL) ALL; Save and exit; In this way, you can add yourself to the sudo group and use the sudo command. By default, the sodo password just entered five minutes later expires. Next time, you need to re-enter the password for sudo. If you think it is difficult to enter the password during sudo, replace the entered one with the following: Your_user_name ALL = (ALL) NOPASSWD: ALL. |