1

I've modified the sudoers file so that a sudo password is required for all except mount and umount for an automated script:

# User privilege specification
root    ALL=(ALL) ALL
pi      ALL=(ALL) ALL
pi      ALL=(ALL) NOPASSWD:/bin/mount, /bin/umount

Have i done this correctly?

The problem i now have is that when logging in via SSH i am prompted to enter my sudo password:

$ ssh pi@xxx.xxx.xxx.xxx

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
[sudo] password for pi: 

Changing the sudoers line to:

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

means that i can login without needing to enter sudo password.

Any thoughts?

Thanks, Richard

0

You shouldn't normally have to do anything via sudo when you log in. Check your .profile file.

If nothing is obvious, put the following line at the top of your .profile:

set -vx

The last line you see before the [sudo] password prompt should be the command that's asking for sudo privs.

  • Thanks for your suggestion. Turns out the raspbmc is configured to run: "sudo /scripts/configure-pi-user.sh" at login this was obviously triggering prompt for sudo password. Where is the list of commands to run at shell logon stored, I'll just comment this out now as I have no need for this config anymore. Thanks – user1027442 Mar 25 '14 at 23:02
  • I've been really stupid, will just comment out the line in .profile file – user1027442 Mar 25 '14 at 23:05
0

I belive this happens because when you login, you need permission to execute a shell (for example: /usr/bin/bash) You need to allow the user pi to execute a shell without entering password

You can in the sudoers file add the following

pi ALL=(ALL) NOPASSWD: /usr/bin/bash 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.