Ubuntu sudo不用输入密码的方法

在启动时进入安全模式,这时是用root登录的,执行:

chmod 740 /etc/sudoers 

然后打开/etc/sudoers这个文件,把最后一行:

# User privilege specification
root    ALL=(ALL:ALL)  ALL

# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL

改为 

# User privilege specification
root    ALL=(ALL:ALL)  ALL

# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) NOPASSWD:ALL

 保存退出。 

执行: 

chmod 0440 /etc/sudoers 

完成

posted @ 2023-05-07 14:51  童年的回忆  阅读(205)  评论(0编辑  收藏  举报
如果本博客解决了您的问题,可以微信支付宝打赏鼓励一下作者哦,在此表示感谢