How could I make my perl script add a server's key to SSH's list?
I have a very annoying problem that has left me scratching me head when my script does not work.
My script need to SSH into my VMware box to run some commands, well I had moved my work from one computer to another (Both running Ubuntu 10.10). And when I ran my script it failed gloriously. I looked through and found that nothing was wrong... and worked on the other machine which was sitting next to me. I had found the problem to be the SSH client, the box I had moved my work to had never logged into the VMware server before so it did have the SSH key for that server stored. Once I ran SSH on its own the script worked fine from then on.
Which brings me to my question.
In perl is there some way I can allow my script to add a SSH key to machine that has never been connected to before? Instead of having to run SSH and answer "y开发者_StackOverflow中文版es" to the question it presents me with asking if I want to permanently add the servers key to my SSH file(s).
The script can run ssh with -o StrictHostKeyChecking=no
to automatically accept host keys from unknown hosts. This has security implications, and I believe even with this option ssh will refuse to connect if the host is already known and the key changes, although that's not clear to me from the documentation.
精彩评论