Leopard下如何让你的sudo不需要输密码

在Snow Leopard的Terminal里面用sudo的时候总是需要输入密码,而在单位的FreeBSD服务器上则不需要。我觉得从安全角度来说这个密码用处不大,有了反而会浪费时间。

搜索了一下,发现要这样做

修改/etc/sudoers文件(记得sudo vi它,存的时候要w!),去掉这一行前面的#号:

%wheel ALL=(ALL) NOPASSWD: ALL

然后执行下面命令,记得将your_username替换为你的用户名:

sudo dscl . append /Groups/wheel GroupMembership your_username

从此就不需要在sudo的时候输入密码了。

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.