How to enable sudo access without password prompting.

AC903919 2011-03-03 08:15:38
Now I have a non-priviledged account acuser, I hope I can logon to the host machine with this account, and while i type "sudo ls" command, i hope it performace the directory lists without prompt for password.

I have tried to type "visudo " to edit the sudo file, and insert "acuser ALL=(ALL) NOPASSWD: ALL" into the file,but it still doesn't work.I don't know what's wrong with it, please help.
...全文
81 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
freetstar 2011-03-04
  • 打赏
  • 举报
回复
提醒你修改完以后把权限修改回来即可
AC903919 2011-03-04
  • 打赏
  • 举报
回复
不好意思,我这边切换中文比较麻烦~~~~~
我是通过root身份去编辑的,难道拿一个non-priviledged的账号去编辑sudo文件可以吗?那还怪了~
justkk 2011-03-04
  • 打赏
  • 举报
回复
please speak 汉语
steptodream 2011-03-04
  • 打赏
  • 举报
回复
你直接用root操作吧 我这里都没有问题 难道你那系统还是特别制造的?
AC903919 2011-03-04
  • 打赏
  • 举报
回复
Many THks.

I have typed the command as you said.

sudo chmod 640 /etc/sudoers
visudo
acuser ALL=(ALL) NOPASSWD: ALL
sudo chmod 440 /etc/sudoers

But while I type the last command,it prompt that
sudo /etc/sudoers mode is 0640,should be 0440
It means chmod failed.

So i tried as follow:
chmod 440 /etc/sudoers

I don't know whether It's right.
steptodream 2011-03-03
  • 打赏
  • 举报
回复
看了看 其实你的设置没问题 问题出在你修改文件的方式上 默认visudo是修改/etc/sudoers文件 但是/etc/sudoers文件是只读的 你修改之后默认文你是否保存到/etc/sudoers.tmp 而你自己没仔细看就保存了 其实你修改后的文件是/etc/sudoers.tmp 而文件/etc/sudoers还是修改之前的!

你这样 先给/etc/sudoers加上可写权限
sudo chmod 640 /etc/sudoers
然后再visudo修改 或者之间用vi修改/etc/sudoers文件
在最后一行追加
acuser ALL=(ALL) NOPASSWD: ALL

然后再把/etc/sudoers的权限改回去
sudo chmod 440 /etc/sudoers
steptodream 2011-03-03
  • 打赏
  • 举报
回复
acuser ALL=NOPASSWD: ALL

23,125

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧