Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use Ubuntu 10.04 in 2 virtual machines. In one machine I have installed Hudson and another machine is to run klocwork. Scenario is when I trigger a build in Hudson, the script has to run successful and call the Klocwork in VM2. In the build script I have given the following command to call Klocwork in machine 2.

if [ $Klocwork = "true" ]; then
echo "Starting Klocwork Report ..."
sshpass -p 'password' ssh IP-address "sudo chmod 755 /local path/build_script_kw.sh;/local path/build_script_kw.sh $SVNID $Version"
fi
echo "Build Successfully."

when I run the script, I get Host key verification failed error. Please provide me a solution for this issue. Thanks.

share|improve this question
    
I found some information about this error notice here: askubuntu.com/questions/45679/… In short: your server key changed(?) –  Rinzwind Aug 27 '12 at 8:15
    
could you please tell me how to check the key information???? –  bsreeram031187 Aug 27 '12 at 8:39
add comment

2 Answers

The first time you connect to another system you will be shown a fingerprint of the remote system's encryption key (which, if you're feeling paranoid, you can check offline).

On the remote system, the command ssh-keygen -lf /etc/ssh/ssh_host_rsa_key will show the fingerprint that should be shown the first time you connect to it.

When you confirm that this is the expected fingerprint, it is stored in the file $HOME/.ssh/known_hosts along with the name of the remote system, so that if you try and connect again and find the key has changed you are warned that the remote system has been changed, or your communications are being intercepted (unlikely, but still...).

In this case, you have maybe re-installed the remote system (so it has a new SSH key but the same name), and hence you are being warned that it has changed.

To correct this, you need to remove the existing entry from the known_hosts file. If you don't mind being asked again to confirm the identity of other machines you connect to, you can just delete known_hosts and it will be recreated the next time you use SSH. Alternatively, you can use the ssh-keygen command to delete the offending key, by doing ssh-keygen -R HOSTNAME (where HOSTNAME is the name of the remote machine).

share|improve this answer
    
after deleting do i need to re configure the ssh?????? –  bsreeram031187 Aug 27 '12 at 13:05
1  
After deleting known_hosts, the next time you connect to the remote computer you'll be asked to confirm the fingerprint is as expected (like the first time you connect to any new system). So connect to it once manually, then the script should work properly after that. –  chronitis Aug 27 '12 at 20:39
add comment

You can skip strict host key verification check using following command.

sshpass -p '<your_password>' ssh <your_server_ip> -o StrictHostKeyChecking=no

Note that above command will solve your problem when key is not present in /root/.ssh/known_host file, but if older key will be present than you have to remove that first by following command

ssh-keygen -R hostname
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.