Question

I am attempting to run a local script on a remote AIX server as root, but it doesn't pause to let me enter the sudo password.

ssh -t user@host 'sudo su' < action.sh
user@host's password:
Password:
Sorry, try again.
Password:
Sorry, try again.
Password:
Sorry, try again.
sudo: 3 incorrect password attempts

Executing without passing in the script works fine.

$ ssh -t user@host 'sudo su'
user@host's password:
Password:
# whoami
root
#

action.sh just contains an 'ls -al' command for testing.

How can I get this to pause so I can enter my password?

No correct solution

OTHER TIPS

This behaviour is straightforward :

STDIN is feeded by your script, so each lines is passed as a password from in the input file.

A solution is to use a pair of ssh keys. Here is a how to to do it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top