rsync client ignores HOME environment Variable

9 posts / 0 new
Last post
Anonymous
rsync client ignores HOME environment Variable

Since my upgrade to the latest version(5.5.0 Free) of cwrsync, the keys aren't found any more.

 

Here is my batch that worked.

What I'm doing wrong.

 

@ECHO OFF

 

REM Make environment variable changes local to this batch file

SETLOCAL

 

REM ** Specify where to find rsync and related files

SET CWRSYNCHOME=D:\Tools\cwRsync

 

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.

SET HOME==C:\Users\Administrator\

REM %USERPROFILE%

 

REM Make cwRsync home as a part of system PATH to find required DLLs

SET CWOLDPATH=%PATH%

SET PATH=%CWRSYNCHOME%;%CWRSYNCHOME%\bin;%PATH%

ECHO "START RSYNC"

rsync -avzr --progress --remove-source-files '/cygdrive/e/backup/' 'backupuser@1.1.1.1:/volume1/BACKUP/'

 

itefix
Offline
Last seen: 2 weeks 32 min ago
Joined: 01.05.2008 - 21:33
Latest versions of Cygwin DLL

Latest versions of Cygwin DLL don't recognize HOME variable from a DOS environment. We have updated cwrsync.cmd file to cope with the problem:

 

@ECHO OFF
REM *****************************************************************
REM
REM CWRSYNC.CMD - Batch file template to start your rsync command (s).
REM
REM *****************************************************************
 
REM Make environment variable changes local to this batch file
SETLOCAL
 
REM Specify where to find rsync and related files
REM Default value is the directory of this batch file
SET CWRSYNCHOME=%~dp0
 
REM Create a home directory for .ssh 
IF NOT EXIST %CWRSYNCHOME%\home\%USERNAME%\.ssh MKDIR %CWRSYNCHOME%\home\%USERNAME%\.ssh
 
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
 
Anonymous
Hello,   thanks for your

Hello,

 

thanks for your answer. But this change is very annoying.

If I use multiple ssh based applications I 've to store the keys in different locations. Not very usefull I think.

For example cwRsync is using /home/%User%/.ssh and OpenSSH is using C:/Users/%User%/.ssh

 

Do you know the reason of this change?

 

Enno
cwRsync unusable for non-superusers

If %HOME% is in the install path, by default C:\Program Files\cwRsync, then with this change only users with write access to the install path, usually administrators, can add the ssh keys. Please reenable settting a user defined %HOME%.

itefix
Offline
Last seen: 2 weeks 32 min ago
Joined: 01.05.2008 - 21:33
As described above, that

As described above, that change appeared in the recent versions of Cygwin DLL - we can't do anything about it. The solution above is just to overcome that problem. It may have some side effects as you describe. You can always make symbolic links from  /home directory to user's real home directory.

Enno
cwRsync unusable for non-superusers

Ok, granted that it is cygwin's fault. Regarding the workaround, that still demands superuser rights to create a symlink to %USERPROFILE% in C:\Program Files\cwRsync.

itefix
Offline
Last seen: 2 weeks 32 min ago
Joined: 01.05.2008 - 21:33
One possible solution can be

One possible solution can be to create etc/fstab to redirect /home directory to somewhere else (C:\users in the example below):

none /cygdrive cygdrive binary,posix=0,user,noacl 0 0

c:/users /home ntfs override,binary,noacl 0 0

See our FAQ for more detailed information and links

Johanz
This one worked for me

This one solved the issue for me. Thanks:

------------------------

One possible solution can be to create etc/fstab to redirect /home directory to somewhere else (C:\users in the example below):

none /cygdrive cygdrive binary,posix=0,user,noacl 0 0

c:/users /home ntfs override,binary,noacl 0 0

------------------------------------------------

Just wondering is it possible to set "HOME" variable for Cygwin.dll via a file in "/etc" like "/etc/profile"?

 

itefix
Offline
Last seen: 2 weeks 32 min ago
Joined: 01.05.2008 - 21:33
 

 

You can do that if you run rsync via a Cygwin-compatible shell like bash. We will consider to extend the free edition by a bash shell to overcome that issue.

 

Release announcements