VBS for cwrsync - RSYNC_PASSWORD gotcha
Posted 12-23-2011 at 01:19 AM by catkin
Updated 12-23-2011 at 01:20 AM by catkin (Added comment moderation and email notification)
Updated 12-23-2011 at 01:20 AM by catkin (Added comment moderation and email notification)
When running cwrsync as SYSTEM it difficult to satisfy rsync's requirement that the password file must be owned by root and readable only by root.
One solution is to set the RSYNC_PASSWORD environment variable.
When using Visual Basic Script to automate the cwrsync run, there's a "gotcha" -- RSYNC_PASSWORD must be a SYSTEM environment variable, not a USER environment variable.
Sample code:
and, to unset it:
When the VBS is run as a Scheduled Task with RSYNC_PASSWORD a USER environment variable, rsync hangs, prompting for a password that cannot be entered. The rsync server log contains a single line, something like:
One solution is to set the RSYNC_PASSWORD environment variable.
When using Visual Basic Script to automate the cwrsync run, there's a "gotcha" -- RSYNC_PASSWORD must be a SYSTEM environment variable, not a USER environment variable.
Sample code:
Code:
objWshShell.Environment("SYSTEM").Item("RSYNC_PASSWORD") = strPassword
Code:
objWshShell.Environment("SYSTEM").Remove("RSYNC_PASSWORD")
Code:
2011/12/22 22:50:12 [2100] connect from CW8vWXP.localdomain (192.168.168.3)
Total Comments 0