Article View: news.software.nntp
Article #81751Re: Authentication for rsync over ssh failing
From: John F. Morse
Date: Wed, 05 Aug 2009 07:58
Date: Wed, 05 Aug 2009 07:58
153 lines
5618 bytes
5618 bytes
Julien ΓLIE wrote: > Hi John, > >>>> During testing I did loosen the access up to 777 and still was not >>>> able >>>> to authenticate with an RSA key using rsync (but ssh and rcp/scp >>>> did work). >>> >>> "still not able" is a funny way to put it. >> >> Why do you think that? > > Because the more the directory has rights, the less you will be able > to connect. > > As Alexander told you, the group should not be able to *write* to the > directory. > > Another thing that may work is to change the home path of the news > user. Say > /home/news, with 700 access and your keys in /home/news/.ssh; I think > you will > then be able to connect with an exchange of keys. > Hi Julien. The chmod 777 was a troubleshooting suggestion found on one of the Web pages from those links I posted. I didn't leave the mode at 777, but only tested it there as the Web page suggested. The mode is 600 for the files, and 700 for the directory. Now, how could someone change the home path of user news when the INN server requires user news to (normally) be at /var/spool/news ? I do have an INN testing server running on the "apache" server. Now I can install the Apache2 Webserver on one of the production INN boxes, and shut down the "apache" server test box to save electricity. ;-) Anyway, I got it working fine by educated guesses, trial and error, and doing something that I didn't find on any of those Websites. Instead of using this command which is shown on those Websites: rsync -avz -e "ssh -i /var/spool/news/.ssh/authorized_keys" news@inn2:/var/www/inn2 /var/www On the "apache" server I simply used: rsync -avz news@inn2:/var/www/news2 /var/www The "inn2" server authenticated properly and sent only those files that were new (or had changed). Why those HOWTOs all had the "-e 'ssh -i /var/spool/news/.ssh/authorized_keys'" in the command is anyone's guess (possibly some Red Hat stuff). I found that the required files, directories, ownerships and permissions are: On the "apache" server: news@apache:/var/spool/news$ ls -al drwx------ 2 news news 104 2009-08-04 21:10 .ssh news@apache:~/.ssh$ ls -al -rw------- 1 news news 1675 2009-08-04 02:27 id_rsa -rw-r--r-- 1 news news 5402 2009-08-04 22:14 known_hosts On the "inn2" server: news@inn2:~$ ls -al drwx------ 2 news news 112 2009-08-04 21:07 .ssh news@inn2:~/.ssh$ ls -al -rw------- 1 news news 395 2009-08-03 20:09 authorized_keys -rw-r--r-- 1 news news 4420 2009-08-04 02:02 known_hosts So simple that I'm surprised someone didn't catch this. (Of course it took me three days!) Back on "apache," in news' home directory, I set up the cron script: news@apache:~$ ls -al drwxr-xr-x 2 news news 144 2009-08-04 22:13 cron [I could probably lock the above down with a chmod 700] news@apache:~/cron$ ls -al -rwxr--r-- 1 news news 59 2009-08-04 21:36 rsync-inn2 [This could probably be a chmod 600] news@apache:~/cron$ cat rsync-inn2 #!/bin/sh rsync -avz news@inn2:/var/www/inn2 /var/www Finally, the cron job parts: news@apache:/etc/cron.d$ ls -al -rw-r--r-- 1 root root 1614 2009-08-04 22:11 inn2 news@apache:/etc/cron.d$ cat inn2 2 1 * * * news /var/spool/news/cron/rsync-inn2 That is very simple, and works slicker than snot. ;-) I discovered that none of the suggestions on the Web sites worked as written, nor any of the suggestions in this newsgroup, with the single exception which Ray Banana supplied: "Can you try ssh -v, as it will give you lots of debug information that might shed some light on the cause of this problem?" That told me that the RSA key access was indeed working, since I could ssh and also scp/rcp without problems or the need to type in a password. It also told me to look at rsync for the problem. I found the problem was the "-e 'ssh -i /var/spool/news/.ssh/authorized_keys'" which failed because no access was yet available to that /var/spool/news/.ssh/authorized_keys file to provide any access! That is the classic "cart-before-the-horse" which I suspected and mentioned in my original post. Thanks for your help, Julien. -- John
Technical Details
Message-ID:
<h5be43$i3t$1@optima5.xanadu-bbs.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder.erje.net!nntp.club.cc.cmu.edu!optima2.xanadu-bbs.net!optima5.xanadu-bbs.net!not-for-mailReferences:
<h58ftm$ndc$1@optima5.xanadu-bbs.net> <80ocqwqgiy.fsf@banana.shacknet.nu> <h58lfi$oq5$1@optima5.xanadu-bbs.net> <h58oji$vu0$2@news.albasani.net> <h5a7uu$7ga$1@optima5.xanadu-bbs.net> <h5aand$d2c$1@news.albasani.net> <h5aisf$aie$1@optima5.xanadu-bbs.net> <h5b7mp$76i$1@news.trigofacile.com>Show Full Headers
Complete Article Headers
Message-ID: <h5be43$i3t$1@optima5.xanadu-bbs.net> Subject: Re: Authentication for rsync over ssh failing Date: Wed, 05 Aug 2009 02:58:59 -0500 From: "John F. Morse" <john@example.invalid> References: <h58ftm$ndc$1@optima5.xanadu-bbs.net> <80ocqwqgiy.fsf@banana.shacknet.nu> <h58lfi$oq5$1@optima5.xanadu-bbs.net> <h58oji$vu0$2@news.albasani.net> <h5a7uu$7ga$1@optima5.xanadu-bbs.net> <h5aand$d2c$1@news.albasani.net> <h5aisf$aie$1@optima5.xanadu-bbs.net> <h5b7mp$76i$1@news.trigofacile.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder.erje.net!nntp.club.cc.cmu.edu!optima2.xanadu-bbs.net!optima5.xanadu-bbs.net!not-for-mail Newsgroups: news.software.nntp Organization: Xanadu BBS Lines: 153 Reply-To: dont.bother Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: optima5.xanadu-bbs.net 1249459139 18557 192.168.89.210 (5 Aug 2009 X-Complaints-To: newsmaster@xanadu-bbs.net NNTP-Posting-Date: Wed, 5 Aug 2009 07:58:59 +0000 (UTC) User-Agent: Thunderbird 2.0.0.22 (X11/20090608) In-Reply-To: <h5b7mp$76i$1@news.trigofacile.com> X-Enigmail-Version: 0.96.0