0

I am trying to write a script that compiles an executable, runs rsync to copy it to a remote server, and then opens an ssh session into the server and dispatches the executable to the grid engine.

In other words, I want a script that does the following:

1. (locally) compile
2. rsync local to remote
3. (remotely) run command to dispatch

The issue I have is that compiling the executable takes a lot of time, and right now my simple bash script will first compile, then prompt my password for the rsync and again for the SSH command.

Is there a way to somehow prompt my password once, prior to the compilation step? We are not allowed to use SSH keys for security reasons.

1

Sure, use sshpass:

read -s -p "Password: " SSHPASS
# compile
rsync -e "sshpass -e ssh" ...
sshpass -e ssh <foo> rm -rf /

Arguably worse security than using keys.

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.