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.

I have server A and server B (both Ubuntu 10.04 LTS) doing different tasks. Server A needs to poke Server B, which generates a file and scp's it back to server A when done. This is all in-house and I am not too concerned about security issues. SSH Key exchange is already performed between servers A and B and works fine.

On server B, the script generateOfflineSig looks like

#!/bin/bash
echo "in script"
sudo apt-offline set offline_package.sig --install-packages "$0"
echo "after sudo"
scp offline_package.sig jeff@servera:/tmp

Also on server B, visudo has this entry:

jeff ALL=NOPASSWD: ALL

Which works if I execute sudo ls on Server B... no password asked.

Unfortunately SSH always asks for a password on Server A:

jeff@servera:~$ ssh -t jeff@serverb /home/jeff/generateOfflineSig "incron"
in script
[sudo] password for jeff:

Any ideas? This process can't be interrupted by password input.

share|improve this question
    
Not 100% sure of /etc/sudoers syntax, but my file has the line # %wheel ALL=(ALL) NOPASSWD: ALL. Maybe your line should be jeff ALL=(ALL) NOPASSWD: ALL? –  snapshoe May 17 '13 at 20:55
    
Doesn't the entire remote command have to be in quotes? You might be executing the script on Sever A –  TheLQ May 17 '13 at 23:56
    
Actually... I think snapshoe is on to something. I'll answer my own question a bit later... –  Jeff May 21 '13 at 13:37
add comment

1 Answer

up vote 0 down vote accepted

It seems like I had a "typo" in the /etc/sudoers file...

jeff ALL=NOPASSWD: ALL

needed to be at the very end of file. Ubuntu Help only says Add (...) to the END of the file (if not at the end it can be nullified by later entries)

After that, password is never asked for "jeff's sudo commands, either locally or over SSH.

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.