Ant: How to avoid SSH passwords?
Problem
- We have a server over which we have FULL control
- We have a long, complicated shell script that interacts with this server via SCP and SSH
- We have an Ant Target that runs the script
simplified example:
<target name="run-script">
<exec executable="/path/to/script_that_runs_ssh_cmds.开发者_JS百科sh" />
</target>
This target fails with the following exception:
ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory
Question
After researching a bit, I think this can be fixed by generating public/private key pairs. That way, the ssh command doesn't have to prompt for passwords. Assuming this solution will work, how do you go about making it so that SSH calls on the system use keys in lieu of prompting for passwords? Is it possible to set this up in a way that anyone on our team can run the Ant target successfully from their laptop?
Note: We're all running OS X 10.6 (Leopard) and physically connected to the same LAN as the server.
You can just install the private key under ~/.ssh
and ssh
will automatically look into that directory and use the key you installed.
In the server side, add the public key to ~/.ssh/authorized_keys
精彩评论