Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This unanswered question is similar to mine except my situation is simpler. After successfully logging in as user ubtuntu with ssh, any sudo command prompts for the user's password with:

[sudo] password for ubuntu:

After authenticating with keys, I would like to not have to provide the password for this user. Is this possible? All the shells are bash. Thanks.

The /etc/sudoers sudoers file on the remote machine:

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

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
share|improve this question
    
Did you read the rest of the file? –  Ignacio Vazquez-Abrams Jul 7 '13 at 8:22
    
@IgnacioVazquez-Abrams thanks, was able to find the info I needed in that previously daunting man sudoers entry. Is the answer I've posted acceptable? (It works but is there a "better" entry you can use in the /etc/sudoers file?) Thanks. –  AJP Jul 7 '13 at 10:34
1  
This is what sudo does. You need to add NOPASSWD to the file, sudo is meant to prompt for a password if a user is allowed to sudo. –  handuel Jul 7 '13 at 10:36
add comment

1 Answer

In man sudoers under the heading User Specification it says:

The basic structure of a user specification is `who = where (as_whom) what'.

Under Tag_Spec it says:

NOPASSWD and PASSWD

By default, sudo requires that a user authenticate him or herself before running a command.

Using visudo edit the line %sudo ALL=(ALL:ALL) ALL to read:

# Allow members of group sudo on any host as any user to execute any command without a password
%sudo   ALL=(ALL:ALL) NOPASSWD: ALL
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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