Results 1 to 4 of 4
Hi all,
I had set up SCP between two Ubuntu servers and created a script to copy a single file between the two without using a passphrase. It was working ...
- 09-07-2011 #1Just Joined!
- Join Date
- Sep 2011
- Posts
- 4
SCP not working after changing IP address on target machine
Hi all,
I had set up SCP between two Ubuntu servers and created a script to copy a single file between the two without using a passphrase. It was working like a champ unti. I had to change the IP address on the target server.
Now running the script caused the following the first time I ran it:
Once the computer is added to the list of trusted machines (I'm guessing this is what's happening) and I agree to continue connecting, I get prompted for the user's password only:Code:The authenticity of host server.mycompany.com can't be established. RSA key fingerprint is 38:bf:b9:a3:e3:64:9a:28:c7:5f:ba:87:12:06:a9:10. Are you sure you want to continue connecting (yes/no)?
Since this SCP copy is scripted, I need this to occur without the password prompt. I think something happened to the keys after changing the IP address for some reason. Perhaps not but I'm lost.Code:myuser<at>server.mycompany.com's password:
Does it make sense that changing the IP address would screw up this job? Can I just recreate the keys on the source server and copy the public key to authorized_keys on the target server? Will that do the trick?
Thanks anybody for your time.
Regards,
JJJ
- 09-08-2011 #2
This sounds like a simple know_hosts issue. Check the files under '.ssh/know_hosts' on the sending system. You should see an entry with the old IP address. Just clear it and run the script by hand so you can accept it and things should be back to normal.
- 09-09-2011 #3Just Joined!
- Join Date
- Sep 2011
- Posts
- 4
Thanks for your reply, Robert.
I checked
./root/.ssh/known_hosts
./home/bitnami/.ssh/known_hosts
and did not find an IP address, just what appear to be the RSA keys. should I be seeing the IP address next to each key?
When I run the scp command as user 'bitnami', I don't get challenged for a password. However if I run the scp command as 'root', I am challenged for bitnami's password. This would make scripting this command under the system crontab impossible, as it stands.
My workaround for the crontab issue was to add the following line to the script:
This seems to have resolved the issue, but I swear I didn't have to do this prior to changing the IP address on the target system.Code:sudo -u bitnami scp $BKUKP bitnami@remoteserver:/backup
I'm more curious than anything else at this point. If you have any thoughts to brighten my mind, I'm much obliged.
Regards,
JJJ
- 09-09-2011 #4
I take it you have setup a key pair for the user bitnami but not for root. If you run the script as root then the password should be for root if you are connecting as root.


Reply With Quote