Reputation: 456
IMPORTANT: that this is not just for this case, I want to create for example .bats to automate some things, then I would like to know how to make him wait for the command to return and interpret my next line as the answer.
How i can do .bat file answer one question comes of a command, for example:
I run it:
ssh -p port user@host
And then it require password, how in the next line i do it answer programatycally in same .bat?
I tryied:
ssh -p port user@host
PASSWORD
But dont works, he discart my PASSWORD and require it in the next line.
Upvotes: 0
Views: 61
Reputation: 75
I don't believe there is a way to save your password. However, you may be able to set up key based authentication so that a password is not required.
> ssh-keygen
> ssh-copy-id -i ~/.ssh/mykey user@host
See https://www.ssh.com/ssh/copy-id for more info
Upvotes: 1