I am writing a program that synchronizes my companies Windows laptops
with our home server. Due to the nature of our proxy/firewall, I must
use SSH with port forwarding to achieve this goal. Currently I establish
the SSH connection using the following command:
ssh ssh_user@proxy.example.com -i file_name -L 873:200.200.60.60:7000 -N
and then run rsync with the following command:
rsync -azv rsync_user@127.0.0.1::package .
This works well as two separate processes. However, having read the
documentation it seems that I should be able to run the ssh commands
"inline" using the -e flag. However, I have not been able to
successfully sync using this method. I have tried using both OpenSSH for
Windows and Plink from Putty. Here is the verbose output from each.
Please note the file has been scrubbed for any information related to my
company :)
rsync -azve "ssh -l ssh_user proxy.example.com -i ssh_key
873:200.200.200.200:7000" rsync_user@127.0.0.1::package .
OpenSSH_3.8.1p1, OpenSSL 0.9.7d 17 Mar 2004
debug1: Connecting to proxy.example.com[IP] port 22.
debug1: Connection established.
debug1: identity file ssh_key type -1
debug1: Remote protocol version 2.0, remote software version 3.2.9.1
SSH Secure Shell (non-commercial)
debug1: no match: 3.2.9.1 SSH Secure Shell (non-commercial)
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.8.1p1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host is known and matches the DSA host key.
debug1: Found key
debug1: ssh_dss_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: ssh_key
debug1: read PEM private key done: type DSA
debug1: Authentication succeeded (publickey).
debug1: Connections to local port 873 forwarded to remote address
200.200.200.200:7000
debug1: Local forwarding listening on 127.0.0.1 port 873.
debug1: channel 0: new [port listener]
debug1: channel 1: new [client-session]
debug1: Entering interactive session.
debug1: Sending command: 127.0.0.1 rsync --server --daemon .
127.0.0.1: not found
debug1: client_input_channel_req: channel 1 rtype exit-status reply 0
debug1: channel 1: free: client-session, nchannels 2
debug1: channel 0: free: port listener, nchannels 1
debug1: fd 1 clearing O_NONBLOCK
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.1 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 127
127.0.0.1: not found
rsync: read error: Connection reset by peer
rsync error: error in rsync protocol data stream (code 12) at
/home/lapo/packaging/tmp/rsync-2.6.2/io.c(354)
rsync -azve "plink -l ssh_user proxy.example.com -i ssh_key -L
873:200.200.200.200:7000 -v" rsync_user@127.0.0.1::package .
Server version: SSH-2.0-3.2.9.1 SSH Secure Shell (non-commercial)
We believe remote version has SSH1 ignore bug
We claim version: SSH-2.0-PuTTY-Release-0.56
Using SSH protocol version 2
Doing Diffie-Hellman key exchange
Host key fingerprint is:
ssh-dss 2048 9a:fc:d2:9d:10:ff:65:4f:df:85:e1:05:40:2a:55:20
Initialised AES-256 client->server encryption
Initialised AES-256 server->client encryption
Initialised HMAC-SHA1 client->server MAC algorithm
Initialised HMAC-SHA1 server->client MAC algorithm
Using username "ssh_user".
Reading private key file
Offered public key
Offer of public key accepted
Authenticating with public key "imported-openssh-key"
Access granted
Opened channel for session
Local port 873 forwarding to 200.200.200.200:7000
Started a shell/command
Sent EOF message
127.0.0.1: not found
Server sent command exit status 127
All channels closed. Disconnecting
rsync: read error: Connection reset by peer
rsync error: error in rsync protocol data stream (code 12) at
/home/lapo/packaging/tmp/rsync-2.6.2/io.c(354)
The output may be a bit excessive, but I wanted to err on the side of
too much information. I hope that there is a solution available and
thank you in advance to any of you who look into this for me.
--
Lewis Franklin
Senior Computing Services Associate
Texas Life Insurance
1-800-283-9233x272