0

Unable to execute shell script, receiving the errors

The shell script I wrote connects to remote server over ssh and executes commands.

sudo: no tty present and no askpass program specified
sudo: pam_authenticate: Conversation error

The User with which I'm establishing ssh connection has sudo privileges on the remote server but the user account is not defined locally within the system [User is authenticating using a centralized service].

While I may have overcome the first error

sudo: no tty present and no askpass program specified

by using "sudo -S" within the script the second error persists

I'm using sshpass utility to pass ssh password:

sshpass -p 'PASSWORD' ssh -n -o StrictHostKeyChecking=no $USER@$IPADDRESS "COMMANDS"
1

Use ssh -t to force TTY allocation so that sudo can ask for your password.

  • I've tried that, didn't work. – karthik vee Mar 30 '18 at 13:47

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.