Find the answer to your Linux question:
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 ...
  1. #1
    Just 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:

    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)?
    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:
    myuser<at>server.mycompany.com's password:
    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.

    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

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,281
    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.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  3. #3
    Just 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:

    Code:
    sudo -u bitnami scp $BKUKP bitnami@remoteserver:/backup
    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.

    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

  4. #4
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,281
    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.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...