Hello Folks Can anyone help with why I can use ssh like so: [root@morgansoldmachine ~]# ssh -t rsync@192.168.1.40 sudo ssh -i /home/rsync/.ssh/id_dsa root@192.168.1.100 Last login: Tue Mar 24 21:32:51 2009 from morgansmachine.lan [root@morgansoldmachine ~]# logout Connection to 192.168.1.100 closed. Connection to 192.168.1.40 closed. [root@morgansoldmachine ~]# But, when I use the same command with the -e option via rsync it fails: [root@morgansoldmachine ~]# ssh -t rsync@192.168.1.40 sudo rsync -avzAXHn --delete-after -e 'ssh -i /home/rsync/.ssh/id_dsa' /etc root@192.168.1.100:/media/bigdisk/morgansmachine/etc root@192.168.1.100's password: Permission denied, please try again. root@192.168.1.100's password: Permission denied, please try again. root@192.168.1.100's password: Permission denied (publickey,gssapi-with-mic,password). rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(600) [sender=3.0.5] Connection to 192.168.1.40 closed. [root@morgansoldmachine ~]# I lost all my hair getting ssh sorted, only to have it fail when run via rsync... Many thanks, Morgan. -- Getting errors: "There are problems with the signature" (or similar)? Update your system by installing certificates from CAcert Inc, see here: http://wiki.cacert.org/wiki/BrowserClients?#head-259758ec5ba51c5205cfb179cf60e0b54d9e378b Or, if Internet Explorer is your default browser, simply click this link: http://www.cacert.org/index.php?id=17 Morgan Read NEW ZEALAND <mailto:mstuffATreadDOTorgDOTnz> fedora + freedom; fact || fiction? http://fedoraproject.org/wiki/Overview get freed-ora! http://www.fsfla.org/svnwiki/selibre/linux-libre/freed-ora
On Sun, Mar 29, 2009 at 05:15:58PM +1300, Morgan Read wrote:> ssh [...] sudo rsync [...] -e 'ssh -i /home/rsync/.ssh/id_dsa' [...]Those quotes won't survive the trip through that many programs, so you're undoubtedly ending up with rsync seeing just the "-e ssh" option, and the -i and beyond are taken as options/args to rsync itself. Your best bet is to put ssh config items into your /root/.ssh/config file. For instance: Host 192.168.1.100 User root IdentityFile /home/rsync/.ssh/id_dsa That sets those settings as the default when accessing that IP. Or give it a name and use that name instead of a hostname or IP when telling rsync what host to contact. For instance, in the local host's .ssh/config file: Host r40 Host 192.168.1.40 User rsync Then on the remote host: Host r100 Host 192.168.1.100 User root IdentityFile /home/rsync/.ssh/id_dsa Then run this (trailing slash added to avoid /path/etc/etc): ssh -t r40 sudo rsync -avzAXHn --delete-after /etc/ r100:/path/etc Your other option is to create a script that executes ssh with the option(s) you want to use and run that script via rsync's -e option. ..wayne..
On 29/03/09 17:15, Morgan Read wrote:> Hello Folks >... On 30/03/09 04:45, Kyle Lanclos wrote:> I suggest putting your 'ssh -i /some/key/here' into a small shell script, > so that you do: > > rsync -e rsync_ssh > > ...and rsync_ssh looks like: > > #! /bin/sh > > exec ssh -i /home/key/here "$@" > > I think the single ticks in the -e option might be throwing something > for a loop.[root@morgansoldmachine ~]# ssh -t rsync@morgansmachine sudo rsync -avzAXHn --delete-after -e /home/rsync/bin/rsync_ssh /etc root@morgansoldmachine:/media/bigdisk/morgansmachine/etc building file list ... done created directory /media/bigdisk/morgansmachine/etc etc/ etc/.pwd.lock etc/.sudoers.tmp.swp ... etc/yum/pluginconf.d/presto.conf etc/yum/pluginconf.d/protect-packages.conf etc/yum/pluginconf.d/whiteout.conf sent 138652 bytes received 17900 bytes 18417.88 bytes/sec total size is 165558833 speedup is 1057.53 (DRY RUN) Connection to 192.168.1.40 closed. [root@morgansoldmachine ~]# Eureka!!! I've done it! Well, not me - thank you everyone. Morgan. -- Getting errors: "There are problems with the signature" (or similar)? Update your system by installing certificates from CAcert Inc, see here: http://wiki.cacert.org/wiki/BrowserClients?#head-259758ec5ba51c5205cfb179cf60e0b54d9e378b Or, if Internet Explorer is your default browser, simply click this link: http://www.cacert.org/index.php?id=17 Morgan Read NEW ZEALAND <mailto:mstuffATreadDOTorgDOTnz> fedora + freedom; fact || fiction? http://fedoraproject.org/wiki/Overview get freed-ora! http://www.fsfla.org/svnwiki/selibre/linux-libre/freed-ora