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 Answer 1

1

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

1
  • I've tried that, didn't work. Commented Mar 30, 2018 at 13:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.