Auth keys not working

7 posts / 0 new
Last post
itefix
Offline
Last seen: 8 hours 50 min ago
Joined: 01.05.2008 - 21:33
Auth keys not working

Hi all,
I have installed the latest cwrsync on my XP box. I want to make backups to my Debian (sarge) box.
The rsync commands are working fine, but it asks me for a password.
I generated with sshkeygen two keys (id_rsa.pub and id_dsa.pub) and placed the in the XP .ssh users home directory. I copied them over to the Debian box, in the home directory under .ssh and parsed them into the authorized_keys file.

The way I generated the keys are:
c:\progra~1\cwrsync\bin\ssh-keygen -t rsa -N "" -f .ssh\id_rsa
c:\progra~1\cwrsync\bin\ssh-keygen -t dsa -N "" -f .ssh\id_dsa

Now I checked the permissioning rights on the Debian box and they seem ok. (Run chmod 644 on the authorized_keys file)

Can anyone help me? Is there a way to increase the logs either on the XP box or on Debian, so I can see what is happening? I have the impression it doesn't even try to authenticate...

Many thanks

I attached the 1>stdout.log 2>sterr.log at the end of the command, but nothing in there.

itefix
Offline
Last seen: 8 hours 50 min ago
Joined: 01.05.2008 - 21:33
Re: Auth keys not working

Can you publish command syntax you are using from your XP PC ?
Do you use cwrsync-supplied batch file template ?

Rgrds Tev

itefix
Offline
Last seen: 8 hours 50 min ago
Joined: 01.05.2008 - 21:33
Re: Auth keys not working

Hi Tev,
thanks for answering. I used the template supplied by cwrsync. Here is my script:

-----------Begin script-------------------------------

REM @ECHO OFF
REM *****************************************************************
REM
REM CWRSYNC.CMD - Batch file template to start your rsync command (s).
REM
REM By Tevfik K. (http://itefix.no)
REM *****************************************************************

REM ** CUSTOMIZE ** Specify where to find rsync and related files (C:\CWRSYNC)
SET CWRSYNCHOME=C:\Progra~1\CWRSYNC

REM Set CYGWIN variable to 'nontsec'. That makes sure that permissions
REM on your windows machine are not updated as a side effect of cygwin
REM operations.
SET CYGWIN=nontsec

REM Set HOME variable to your windows home directory. That makes sure
REM that ssh command creates known_hosts in a directory you have access.
REM SET HOME=C:\\%HOMEPATH%

REM Make cwRsync home as a part of system PATH to find required DLLs
SET CWOLDPATH=%PATH%
SET PATH=%CWRSYNCHOME%\BIN;%PATH%

REM Windows paths may contain a colon (:) as a part of drive designation and
REM backslashes (example c:\, g:\). However, in rsync syntax, a colon in a
REM path means searching for a remote host. Solution: use absolute path 'a la unix',
REM replace backslashes (\) with slashes (/) and put -/cygdrive/- in front of the
REM drive letter:
REM
REM Example : C:\WORK\* --> /cygdrive/c/work/*
REM
REM Example 1 - rsync recursively to a unix server with an openssh server :
REM
REM rsync -r /cygdrive/c/work/ remotehost:/home/user/work/
REM
REM Example 2 - Local rsync recursively
REM
REM rsync -r /cygdrive/c/work/ /cygdrive/d/work/doc/
REM
REM Example 3 - rsync to an rsync server recursively :
REM (Double colons?? YES!!)
REM
REM rsync -r /cygdrive/c/doc/ remotehost::module/doc
REM
REM Rsync is a very powerful tool. Please look at documentation for other options.
REM

REM ** CUSTOMIZE ** Enter your rsync command(s) here

REM SET RSYNCCMD=rsync -e %CWRSYNCHOME%\bin\ssh -av --delete --delete-excluded
SET RSYNCCMD=rsync -e %CWRSYNCHOME%\bin\ssh -av --delete --delete-excluded 1>stdout.log 2>sterr.log
SET EXCLUDES=--exclude "emp" --exclude "RECYCLEache' --exclude 'ache*'
SET EXCLUDES=%EXCLUDES% --exclude 'Temporary Internet Files'

SET REMOTE=@:/safe

c:
cd \
SET DIRS=test
echo Backing up from C: drive: %DIRS%
REM %RSYNCCMD% %EXCLUDES% %DIRS% %REMOTE%/c
%RSYNCCMD% %DIRS% %REMOTE%/c

set HOME=
set CWRSYNCHOME=
set CYGWIN=
set PATH=%CWOLDPATH%

------------------End script---------------------------------

Thanks

itefix
Offline
Last seen: 8 hours 50 min ago
Joined: 01.05.2008 - 21:33
Re: Auth keys not working

Hi Tev,
did some further tests:
If I test the ssh specifying the key file it works, i.e

ssh -i c:\\.ssh\id_dsa.pub @

this would mean the keys are correct and can be read.

The HOME path in my script is not commented it is set as
SET HOME=C:\

Bests

itefix
Offline
Last seen: 8 hours 50 min ago
Joined: 01.05.2008 - 21:33
Re: Auth keys not working

You are right. You should define -e "ssh -i your key file" in your rsync command. You may check also FAQ I want to set up ssh communication without passwords !!. You can also increase ssh output verbosity by specifying -e "ssh -v -i your key file".

itefix
Offline
Last seen: 8 hours 50 min ago
Joined: 01.05.2008 - 21:33
Re: Auth keys not working

Hi Tev,
I edited my rsync command as followed:

SET RSYNCCMD=rsync -e %CWRSYNCHOME%\bin\ssh -i "%HOME%\.ssh\id_rsa.pub" -av --delete --delete-excluded

but that doesn't work. Were is my error?

Thanks

itefix
Offline
Last seen: 8 hours 50 min ago
Joined: 01.05.2008 - 21:33
Re: Auth keys not working

Following command has better chance to work:

SET RSYNCCMD=rsync -e "ssh -i %HOME%\.ssh\id_rsa.pub" -av --delete --delete-excluded

NB! I assume that %HOME% does not expand to a value containing spaces. In that case, you should use short file names.

Topic locked