I'm running a Windows 2003 Server and cwRsync V 2.0.4 and with OpenSSH and I'm intermittently getting the following error.
"rsync: failed to connect to localhost: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(98)"
The connection will work approximately 1 in every 4 times. When it works over SSH it works perfectly. I'm just using the "Secure Channel Wizard" to create the batch files to run which I'm scheduling. The client is also a Windows 2003 server and I have no firewall blocking any ports.
Any help would be greatly appreciated.
How does your batch file look like ?
Are there multiple network interfaces ? Can you double check if there are some zombie rsync processes lurking around ? Any solution if you replace localhost with 127.0.0.1 ? Is port 9119 busy on client side sometimes ?
Whoops, sorry should be
@ECHO OFF
SET SECHAW_IDENTITY="C:\Program Files\cwRsync\cwrsync"
SET SECHAW_TYPE=ssh
SET SECHAW_LOCALPORT=9119
SET SECHAW_SERVER=218.214.21.20
SET SECHAW_SERVERPORT=873
SET SECHAW_USER=SvcwRsync
SET SECHAW_CMD="C:\Program Files\cwRsync\bin\rsync.exe" -ravz --delete /cygdrive/d/documents rsync://SvcwRsync@localhost:9119/fit
SET SECHAW_TUNNEL=ssh -i "C:\Program Files\cwRsync\cwrsync" -L 9119:127.0.0.1:873 SvcwRsync@218.214.21.20 -T -N
"C:\Program Files\cwRsync\bin\sechaw.exe" --verbose
After a heap of testing I found that running the batch file manually worked flawlessly, however running through scheduled tasks caused me grief eveytime (particularly on a domain controller).
It seems the problem has to do with a scheduled batch file having problems accessing the known_hosts file. The batch file doesn't seem to take on the HOMEDRIVE path that the profile runs under. This seemed to work intermittently running as local account on a member server but not at all on a domain controller.
By using the SSH "UserKnownHostsFile" option in a config file resolved my problem and it has been working perfectly since.
Hope that makes sense.
Mal,Can you elaborate further on this? We're having our clients run the batch manually, but we have the same issue. Most of our clients are mobile and aren't domain members, but permissions may still be the issue.
What config file did you put UserKnownHostsFile in?
Thanks,
Jeff
Mal,
Can you elaborate further on this? We're having our clients run the batch manually, but we have the same issue. Most of our clients are mobile and aren't domain members, but permissions may still be the issue.
What config file did you put UserKnownHostsFile in?
Thanks,
Jeff
It is possible to specify a configuration file for ssh. It is .ssh/config by default. See ssh_config man page for more information.
I am trying to connect manually with no success. Can you explain the how you use UserKnownHostsFile in more detail?
Using the Secure Channel Wizard you just add a -F and the path of the config file, to the ssh command, something like:"SET SECHAW_TUNNEL=ssh -F C:\Config\ssh_config -i"The ssh_config file contains the following:
"UserKnownHostsFile C:\config\known_hosts"
You just need to ensure that the known_hosts has the public key. Still working a treat, I hope that helps.
I have the same problem when troying to execute my script with tng.I created my ssh_conf file with link to the known_hosts file.
After modified my batch file i got the "error" message :
sechaw - secure channel wrapper version 1.2, August 2005
ITeF!x Consulting, http://itefix.no
Enter 'sechaw --help' for detailed help information
Usage:
sechaw
Options:
-ty, --type
-c, --command
-tu, --tunnel
-l, --localport
-r, --remoteport
--host
-i, --identity
-u, --user
-v, --verbose
--help
Here's my bacthfile :
SET SECHAW_IDENTITY="D:\localapp\apps\cwRsync\Key\lluxsapp540"
SET SECHAW_TYPE=ssh
SET SECHAW_LOCALPORT=9119
SET SECHAW_SERVER=serveur540
SET SECHAW_SERVERPORT=873
SET SECHAW_USER=SvcwRsync
SET SECHAW_CMD="D:\localapp\apps\cwRsync\bin\rsync.exe" -av
/cygdrive/d/wwwroot/dexiaplus/VIS/ rsync://SvcwRsync@localhost:9119/TestVIS/
SET SECHAW_TUNNEL=ssh -F "D:\localapp\apps\cwRsync\config\ssh_config" -i
"D:\localapp\apps\cwRsync\Key\serveur540" -L 9119:127.0.0.1:873
SvcwRsync@serveur540 -T -N
"D:\localapp\apps\cwRsync\bin\sechaw.exe" --verbose
Any idea ??? Thanks in advance.
Gaut,
I don't know if you have figured it out yet, but it looks to me your -i parameter is incorrect and should specify the identity key which you have set in the top line as "lluxsapp540"
SET SECHAW_TUNNEL=ssh -F "D:\localapp\apps\cwRsync\config\ssh_config" -i
"D:\localapp\apps\cwRsync\Key\lluxsapp540" -L 9119:127.0.0.1:873
SvcwRsync@serveur540 -T -N
Also I think you could try using a much shorter path with the -F ssh_config file parameter. I remember having issues with this and it seemed not to work correctly unless it was a short path without spaces or inverted commas, hence why I used C:\config\ssh_config.
Hopefully one of those solves your problem.
Hello,
What's the content of your file ssh_config.txt ?
-> UserKnownHostsFile C:\Program Files\cwRsync\know_hosts.txt
Then what's the content of know_hosts.txt ?
Regards,
David
Hello,
What's the content of your file ssh_config.txt ?
-> UserKnownHostsFile C:\Program Files\cwRsync\know_hosts.txt
Then what's the content of know_hosts.txt ?
Regards,
David
Check ssh_config documentation.
Hello Tev,
I already read all this document but doesn't understand.
Here is what a typical ~/.ssh/known_hosts file might contain. Note that newton is represented on two different lines:
newton 1024 35 153438062610297067329638677441205712613292203533062535600064224677647442245028855505387934431717435134842994423656065076260604296084868001730665553662299156116414854701274715680961503198280525759778667306417179500370189017139564144825610347509023078143132936185076849630461827976942220442313116255293297021841
ucsub 1024 37 132170811640421742212085598383135714069016332111955003414250071326834884018721183646445780180633494496866895830879394309011412231102757022090299732775466435482517698989962531081214859205054227533597152962802400251809883548442498002326460312850336779152617243800769119880843882425555806081435017335194477605333
simpson 1024 41 84089692059249458440345362273528263453600205470157624776507876697481412839375294315107162983484390901602702661279164375297211645960275026726690836525966507273615949171966757621717137045892868050436884725563247792566023489318554721885765548457461907512536847079297627580626353420887972219277539015703446529603
newton,128.138.249.8 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA0d7Aoure0toNJ+YMYi61QP2ka8m5x5ZQlT7obP8CK3eropfqsMPPY6uiyIh9vpiFX2r1LHcbx139+vG6HOtVvuS8+IfMDtawm3WQvRuOopz3vVy5GtMwtaOgehsXoT930Ryev1bH5myPtWKlipITsOd2sX9k3tvjrmme4KCGGss=
Does it mean that I need to define :
toto content of my cwrsync.txt(Key)
and toto will be the name of my server wich I use in my bat file :
SET SECHAW_SERVER=toto
Is that correct or mix i everything ?
David
Hello Tev,
I already read all this document but doesn't understand.
Does it mean that I need to define :
toto content of my cwrsync.txt(Key)
and toto will be the name of my server wich I use in my bat file :
SET SECHAW_SERVER=toto
Is that correct or mix i everything ?
David
If you want to add host toto to your known_hosts file, you can concatenate output from ssh-keyscan:
ssh-keyscan toto/ip-address -t rsa >> your known_hosts file
Need I to add this in my bat files ?
Or must I do it once on the client computer ?
Where can I find ssh-keyscan ?
In the package I have :
blat.exe
cygcrypto-0.9.8.dll
cygminires.dll
cygwin1.dll
cygz.dll
dt.exe
plink.exe
puttygen.exe
rsync.exe
sechaw.exe
SecureChannelWizard.exe
ssh.exe
ssh-keygen.exe
but no ssh-keyscan
Thanks for your help.
David
ssh-keyscan toto/ip-address -t rsa >> your known_hosts file
Need I to add this in my bat files ?
Or must I do it once on the client computer ?
Where can I find ssh-keyscan ?
In the package I have :
but no ssh-keyscan
Thanks for your help.
It is a part of cwRsync Server package (with openssh component).
I figured out why our connection is intermittent. It appears that SSHD.exe does not always close properly following a successful sync. Because of this, multiple SSHD.exe processes become launched. In order to restore service, all instances have to be terminated and OpenSSH restarted. I hope this helps for developing 2.0.5...
Jeff
I had the same issue.
Script on a domain controller worked fine when run within the user's session but would appear to hang whenever it was run from as a scheduled task.
I discovered that the HOME variable was not being set when the task was run while the user was not logged in.
My fix, specify the HOME variable to the users home folder.
Example:
User = backupuser
HOME="C:\Documents and Settings\backupuser"
This is different from the example script that uses %HOMEDRIVE%%HOMEPATH%.
This enables ssh to find the "known_hosts" file for this user and everything works again as a scheduled task.