linux赋予普通用户sudo权限使用sudo命令不用输入密码

centos系列

编辑 /etc/sudoers 文件 或者 使用visudo命令

把 “# %wheel ALL=(ALL) ALL” 前面的 ‘# ‘ 去掉,让这一行生效。它的意思是,wheel这个组的所有用户都拥有了sudo的权利。接下来就需要你把想让有sudo权利的所有用户加入到wheel这个组中即可。

例如添加test用户

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

保存退出重启系统,后面输入命令带sudo就不需要输入密码了

debian系列

使用vi或者vim命令编辑 /etc/sudoers 文件

在 root   ALL=(ALL:ALL) ALL 下面添加一行

例如添加test用户

test   ALL=(ALL:ALL) NOPASSWD:ALL

保存退出重启系统,后面输入命令带sudo就不需要输入密码了
sanradar
sanradar
文章: 97

6 评论

  1. hello there and thank you for your info – I’ve
    definitely picked up something new from right here.
    I did however expertise some technical issues using this site, as I experienced to reload the website many times previous to I could get it
    to load correctly. I had been wondering if your web host is OK?
    Not that I’m complaining, but sluggish loading instances times will often affect your placement in google and can damage
    your high-quality score if ads and marketing with Adwords.
    Anyway I am adding this RSS to my e-mail and can look out for much more of your respective fascinating content.
    Ensure that you update this again very soon.. Escape room

留下评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注