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?

没有正确的解决方案

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top