Linux root user is a super administrator, generally do not use this user login to operate, but sometimes need root permissions, and do not want to switch users can be used sudo command. However, not all users can use the sudo command.
You may first encounter the following prompt:
Xxxis not in the sudoers file. This incident would be reported.
Workaround:
1. Modify the/etc/sudoers file
#su-
#chmod u+w/etc/sudoers
The next line in Root all= (all) is added
Username all= (All) all
#chmod u-w/etc/sudoers
You may also encounter the following prompt
SUDO:XXX: Command not found
This is the path problem, continue with the following operation
2. Add the user to the wheel group
#vi/etc/passwd
Change the user's group number to ten (the Whell group number is 10, this step requires a re-login to take effect)
3. Modify Sudo configuration file/etc/sudoers
#visudo
or direct vi/etc/sudoers.
Defaults env_keep = "COLORS DISPLAY HOSTNAME histsize INPUTRC kdedir
Ls_colors MAIL PS1 PS2 qtdir USERNAME
LANG lc_address lc_ctype lc_collate lc_identification
Lc_measurement lc_messages lc_monetary lc_name lc_numeric
Lc_paper lc_telephone lc_time lc_all LANGUAGE Linguas
_xkb_charset xauthority PATH "
Add path to the Env_keep. (This step requires a re-login to take effect)
4, modify the/etc/profile
# Path Manipulation
#if ["$EUID" = "0"]; then;
Revision changed to
Gid= '/usr/bin/id-g '
If [$gid-eq];then
#source/etc/profile
This solves the problem.
If you do not want the root user to log in remotely, you can do the following:
Modify the configuration file/etc/sshd/sshd_config,
Find Permitrootlogin in the file
"Permitrootlogin No" means that the root user is not allowed to telnet,
"Permitrootlogin yes" means allowing the root user to remotely
Modify to the desired result