Posted: 2013-01-04 13:44
We use WinSCP.exe in a Windows scheduled task to move some files from a shared drive to an SFTP server. I have discovered that in order for WinSCP to successfully change local directory (lcd), the Traverse NTFS permission is required on the local directory for the user who is running the WinSCP scheduled task. I confirmed this by running the WinSCP.com console application interactively and issuing lcd "the-directory-path"; the message Error changing directory was returned. Is this expected behaviour? I checked how the built-in Windows FTP behaves and it does not give an error; issuing lcd "the-directory-path" appears to successfully change directory.
Using WinSCP 5.2.1 on Windows 7 SP1 64-bit
Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="G:\CCS\Content\Bibliographic Services\Acquisitions\WinSCP-invoice-move.log" /command "option batch abort" "option confirm off" "open libapp0" "lcd ""G:\CCS\Content\Bibliographic Services\Acquisitions\EDI Invoices""" "cd /exlibris/aleph/u19_1/yor50/edi/in/edi_incoming" "put -delete *" "exit"
Error in log:
. 2013-01-04 10:39:12.257 Getting current directory name.
. 2013-01-04 10:39:12.257 Startup conversation with host finished.
< 2013-01-04 10:39:12.257 Script: Active session:  libapp0
> 2013-01-04 10:39:12.257 Script: lcd "G:\CCS\Content\Bibliographic Services\Acquisitions\EDI Invoices"
< 2013-01-04 10:39:12.257 Script: Error changing directory to 'G:\CCS\Content\Bibliographic Services\Acquisitions\EDI Invoices'.
. 2013-01-04 10:39:12.257 Script: Failed
. 2013-01-04 10:39:12.257 Script: Exit code: 1
. 2013-01-04 10:39:12.257 Closing connection.
. 2013-01-04 10:39:12.273 Sending special code: 12
. 2013-01-04 10:39:12.273 Sent EOF message
Last edited by Jimbob9 on 2013-01-04 23:42; edited 5 times in total
Posted: 2013-01-04 18:19
I've investigated a bit further. According to Sysinternals' Process Monitor program, both winscp.exe and Windows' ftp.exe desire Traverse permission when the lcd command is issued. Interestingly, in the case of ftp.exe, an error message lcd-ing is only returned when the session was begun with ftp [host name] at the command prompt. When the session begins with simply ftp and then open [hostname] is issued at the ftp prompt, lcd-ing appears to work; a message is returned to the effect that the lcd command succeeded. Furthermore, Process Monitor indicated that - outside of winscp/ftp.exe, in a cmd.exe environment - a simple cd [path] from a command prompt does not require the Traverse permission.
To sum up, I would guess Traverse is a standard permission requirement for lcd (though I'm not sure why). So I just need to live with this and fix the NTFS permissions!
You can post new topics in this forum
And it's free!