Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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. – w4etwetewtwet Jul 7 '13 at 10:36

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:


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
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .