Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: ssh/rsync issues

  1. #1
    Join Date
    Dec 2008
    Location
    The Desert
    Beans
    281
    Distro
    Ubuntu 12.04 Precise Pangolin

    ssh/rsync issues

    So i recently updated my server from 10.04 to 12.04. I had a script that I used to backup and sync my music from my laptop to the server
    Code:
    #!/bin/sh
    LOCALDIR=/home/djyoung4/Music/
    REMOTEDIR=/mnt/Storage1/Music/
    SERVER=192.168.1.102
    echo Syncing with $SERVER
    echo Sending...
    rsync --rsh=ssh -aizuKL $LOCALDIR home@$SERVER:$REMOTEDIR
    echo Fetching...
    rsync --rsh=ssh -aizuKL home@$SERVER:$REMOTEDIR $LOCALDIR 
    notify-send sync done
    exit
    with the update to 12.04 I cannot get the script to work correctly. I keep getting a connection refused port 22 closed
    Code:
    [djyoung4@archbang Documents]$ sh Musicsync.sh
    Syncing with 192.168.1.102
    Sending...
    ssh: connect to host 192.168.1.102 port 22: Connection refused
    rsync: connection unexpectedly closed (0 bytes received so far) [sender]
    rsync error: unexplained error (code 255) at io.c(605) [sender=3.0.9]
    Fetching...
    ssh: connect to host 192.168.1.102 port 22: Connection refused
    rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
    rsync error: unexplained error (code 255) at io.c(605) [Receiver=3.0.9]
    rsync and openssh are installed on both machines and googling has turned up nothing so far. any ideas?
    I can vnc into the box no problem
    Last edited by djyoung4; October 16th, 2012 at 09:52 PM.
    I'm a super power user

  2. #2
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,796
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: ssh/rsync issues

    Hi djyoung4.

    Let's try to make sure your ssh connection is working OK.

    Could you post the result of an ssh connection using the triple verbose option?
    Code:
    ssh -vvv 192.168.1.102
    Regards.

  3. #3
    Join Date
    Dec 2008
    Location
    The Desert
    Beans
    281
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: ssh/rsync issues

    Code:
    [djyoung4@archbang Documents]$ sudo ssh -vvv server@192.168.1.102
    OpenSSH_6.1p1, OpenSSL 1.0.1c 10 May 2012
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to 192.168.1.102 [192.168.1.102] port 22.
    debug1: connect to address 192.168.1.102 port 22: Connection refused
    ssh: connect to host 192.168.1.102 port 22: Connection refused
    I'm a super power user

  4. #4
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,796
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: ssh/rsync issues

    Thanks.

    It look like the ssh service is not running, or set to use another port.

    Could you post the results of these commands on the server?
    Code:
    apt-cache policy openssh-server 
    
    sudo service ssh status
    
    grep -i port /etc/ssh/sshd_config
    Regards.

  5. #5
    Join Date
    Dec 2008
    Location
    The Desert
    Beans
    281
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: ssh/rsync issues

    Code:
    server@server-home:~$ apt-cache policy openssh-server
    openssh-server:
      Installed: (none)
      Candidate: 1:5.9p1-5ubuntu1
      Version table:
         1:5.9p1-5ubuntu1 0
            500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
    server@server-home:~$ sudo service ssh status
    [sudo] password for server: 
    ssh: unrecognized service
    server@server-home:~$ grep -i port /etc/ssh/sshd_config
    grep: /etc/ssh/sshd_config: No such file or directory
    ha seems to be my problem
    I'm a super power user

  6. #6
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,796
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: ssh/rsync issues

    Thanks.

    The server side of the openssh package has not been installed yet on the server.

    Install it like this:
    Code:
    sudo apt-get install openssh-server
    Let us know how it goes.
    Regards.

  7. #7
    Join Date
    Dec 2008
    Location
    The Desert
    Beans
    281
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: ssh/rsync issues

    Code:
    [djyoung4@archbang Documents]$ sh Musicsync.sh
    Syncing with 192.168.1.102
    Sending...
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
    Someone could be eavesdropping on you right now (man-in-the-middle attack)!
    It is also possible that a host key has just been changed.
    The fingerprint for the RSA key sent by the remote host is
    a0:7c:46:25:f5:42:c8:d7:f0:80:e4:5b:2b:a2:82:06.
    Please contact your system administrator.
    Add correct host key in /home/djyoung4/.ssh/known_hosts to get rid of this message.
    Offending RSA key in /home/djyoung4/.ssh/known_hosts:2
    RSA host key for 192.168.1.102 has changed and you have requested strict checking.
    Host key verification failed.
    rsync: connection unexpectedly closed (0 bytes received so far) [sender]
    rsync error: unexplained error (code 255) at io.c(605) [sender=3.0.9]
    Fetching...
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
    Someone could be eavesdropping on you right now (man-in-the-middle attack)!
    It is also possible that a host key has just been changed.
    The fingerprint for the RSA key sent by the remote host is
    a0:7c:46:25:f5:42:c8:d7:f0:80:e4:5b:2b:a2:82:06.
    Please contact your system administrator.
    Add correct host key in /home/djyoung4/.ssh/known_hosts to get rid of this message.
    Offending RSA key in /home/djyoung4/.ssh/known_hosts:2
    RSA host key for 192.168.1.102 has changed and you have requested strict checking.
    Host key verification failed.
    rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
    rsync error: unexplained error (code 255) at io.c(605) [Receiver=3.0.9]
    I cant seem to figure out where to add the new RSA key. Hopefully someone isn't really doing something nasty.
    edit: I added it in the file and ran the script and still no luck. just gave me some other errors and then closed the terminal before I could copy them
    Last edited by djyoung4; October 16th, 2012 at 10:38 PM.
    I'm a super power user

  8. #8
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,796
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: ssh/rsync issues

    Either remove the second line of your ~/.ssh/know_hosts, or just remove the file (if you don't ssh to other machines).

    Try again, and let us know how it goes.
    Regards.

  9. #9
    Join Date
    Apr 2011
    Location
    Maryland
    Beans
    1,461
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: ssh/rsync issues

    I think you're getting that because your system is recognizing that the server has changed and now has a different key. If purge the server's entry from ~/.ssh/known_hosts you should be OK again.

    If you can't decipher which is the server's (which is not unlikely!) I think you can just purge the whole file. The only downside side that I've seen is that you just have to say "yes" to add a key when connecting to a server that you've connected to before. You can test by just backing the file up before you delete it (just changing the name is enough).

  10. #10
    Join Date
    Apr 2011
    Location
    Maryland
    Beans
    1,461
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: ssh/rsync issues

    Quote Originally Posted by papibe View Post
    Either remove the second line of your ~/.ssh/know_hosts, or just remove the file (if you don't ssh to other machines).

    Try again, and let us know how it goes.
    Regards.
    Not only beat me to it...but taught me something in the process! Now I know where to look for the offending key in the file. I usually just purge the whole file, which is not a big deal, but a bit of a pain since I connect to a bunch of different servers. Thanks!

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

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