步骤一:给用户添加相应的 sudo 权限
# vim /etc/sudoers
或者:
# visudo
添加以下内容:
……
zhumingyu ALL=(ALL) /usr/bin/mysql
(补充:这里以给用户 zhumingyu 添加 /usr/bin/mysql 命令为例)
步骤二:设置用户使用自己的密码实现 sudo 提权
# vim /etc/sudoers
或者:
# visudo
将以下内容:
......
#Defaults targetpw # ask for the password of the target user i.e. root
#ALL ALL=(ALL) ALL # WARNING! Only use this together with 'Defaults targetpw'!
......
修改为:
......
Defaults targetpw # ask for the password of the target user i.e. root
ALL ALL=(ALL) ALL # WARNING! Only use this together with 'Defaults targetpw'!
......