문제

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