How do I turn on 'Ignore permission errors'?

Advertisement

daustin
Joined:
Posts:
1

How do I turn on 'Ignore permission errors'?

I'm getting the error
WinSCP.SessionRemoteException: Upload of file 'test.txt' was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn on 'Ignore permission errors' option. ---> WinSCP.SessionRemoteException: Permission denied.

when transferring files with the .NET assembly and sftp. How do I turn on 'Ignore permission errors' using the .NET code as indicated in the error?

Reply with quote

Advertisement

warrenb
Joined:
Posts:
2
Location:
United States

I'm using the .Net component Version=1.1.4.3970 and am getting the following error in the WinSCP log file when running the SFTP SynchronizeDirectories code:

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

. 2014-03-20 13:27:32.206 Preserving timestamp [2014-03-19T19:51:43.000Z]
< 2014-03-20 13:27:32.206 Type: SSH_FXP_STATUS, Size: 44, Number: 1545
< 2014-03-20 13:27:32.206 Status code: 8, Message: 1545, Server: SSHServerAPI.SFTP.fxp_attrs, Language:
* 2014-03-20 13:27:32.206 (ETerminal) The server does not support the operation.
* 2014-03-20 13:27:32.206 Error code: 8
* 2014-03-20 13:27:32.206 Error message from server: SSHServerAPI.SFTP.fxp_attrs
. 2014-03-20 13:27:32.207 Asking user:
. 2014-03-20 13:27:32.207 **Upload of file 'test123.txt' was successful, but error occurred while setting the permissions and/or timestamp.**
. 2014-03-20 13:27:32.207
. 2014-03-20 13:27:32.207 If the problem persists, turn off setting permissions or preserving timestamp. Alternatively you can turn on 'Ignore permission errors' option. ("The server does not support the operation.
. 2014-03-20 13:27:32.207 Error code: 8
. 2014-03-20 13:27:32.207 Error message from server: SSHServerAPI.SFTP.fxp_attrs")
< 2014-03-20 13:27:32.207 Script: Upload of file 'test123.txt' was successful, but error occurred while setting the permissions and/or timestamp.
< 2014-03-20 13:27:32.207 If the problem persists, turn off setting permissions or preserving timestamp. Alternatively you can turn on 'Ignore permission errors' option.
< 2014-03-20 13:27:32.208 Script: The server does not support the operation.
< 2014-03-20 13:27:32.208 Error code: 8
< 2014-03-20 13:27:32.208 Error message from server: SSHServerAPI.SFTP.fxp_attrs
* 2014-03-20 13:27:32.212 (EScpSkipFile) **Upload of file 'test123.txt' was successful, but error occurred while setting the permissions and/or timestamp.**
* 2014-03-20 13:27:32.212
* 2014-03-20 13:27:32.212 If the problem persists, turn off setting permissions or preserving timestamp. Alternatively you can turn on 'Ignore permission errors' option.
* 2014-03-20 13:27:32.212 The server does not support the operation.
* 2014-03-20 13:27:32.212 Error code: 8
* 2014-03-20 13:27:32.212 Error message from server: SSHServerAPI.SFTP.fxp_attrs
. 2014-03-20 13:27:32.212 Script: Failed
> 2014-03-20 13:27:32.714 Script: exit
. 2014-03-20 13:27:32.714 Script: Exit code: 1
. 2014-03-20 13:27:32.714 Closing connection.
. 2014-03-20 13:27:32.714 Sending special code: 12
. 2014-03-20 13:27:32.714 Sent EOF message

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

The component copies one file and then gives up with the errors above.
I'm using
transferOptions.PreserveTimestamp = false;

and
transferOptions.FilePermissions = null;
is default, so I should not have to set that, right?

Is their a bug or some other option that needs to be set?

Thanks,

-Warren.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,123
Location:
Prague, Czechia

Setting transferOptions.PreserveTimestamp = false should be enough. But obviously it is not applied, see "Preserving timestamp". Do you pass the transferOptions to the Session.PutFiles method? Please show your full code.

Reply with quote

warrenb
Joined:
Posts:
2
Location:
United States

After more testing I see that SynchronizeDirectories fails with the errors posted above when attempting to sync multiple files to an Ipswitch WS_FTP 7.5 SFTP server, but when performing the same sync of multiple files to an SSH Systems Tectia SFTP server, no errors are seen in the log file. Yes, I am passing the TransferOptions.

Here's the code I'm using. Note that the programming language is Winbatch

;** Set WinSCP SFTP component options
objSessionOptions = ObjectClrNew( 'WinSCP.SessionOptions' )
objProtocol = ObjectClrNew( 'WinSCP.Protocol' )
Sftp = ObjectClrType( 'WinSCP.Protocol', objProtocol.Sftp )
objSessionOptions.Protocol = Sftp
objSessionOptions.HostName = serverName
objSessionOptions.UserName = userID
objSessionOptions.Password = userPassword

;Get the host key fingerprint by using winscp GUI version to connect to the FTP server with the ID you will be using.
objSessionOptions.SshHostKeyFingerprint = "ssh-rsa 1024 f1:****removed******
;objSessionOptions.GiveUpSecurityAndAcceptAnySshHostKey ; if you don't want to mess with fingerprint, use this


;Create an instance of the WinSCP.Session class.
objSession = ObjectClrNew("WinSCP.Session" )

;Define Log File
objSession.SessionLogPath = webCashDRLog

;Open session
objSession.Open(objSessionOptions)

; Synchronize Directories
bFalse = ObjectType( 'BOOL', 0 )
bTrue = ObjectType( 'BOOL', 1 )
objMode = ObjectClrNew( 'WinSCP.SynchronizationMode' )
modeRemote = ObjectClrType( 'WinSCP.SynchronizationMode', objMode.Remote ) ; Only the remote directory is modified.
objCriteria = ObjectClrNew( 'WinSCP.SynchronizationCriteria' )
criteriaTime = ObjectClrType( 'WinSCP.SynchronizationCriteria', objCriteria.Time ) ; File times are compared to determine which is newer.
objTransferOptions = ObjectClrNew( 'WinSCP.TransferOptions' )
objTransferMode = ObjectClrNew( 'WinSCP.TransferMode' )
objTransferOptions.TransferMode = ObjectClrType( 'WinSCP.TransferMode', objTransferMode.Binary )
objTransferOptions.PreserveTimestamp = bFalse

;** Synchronize with SFTP server.
SynchronizationResult = objSession.SynchronizeDirectories( modeRemote, LocalPath, remotePath, bTrue, bFalse, criteriaTime, objTransferOptions)

; Disconnect, clean up
objSession.Dispose()
objCriteria = 0
objTransferMode = 0
objTransferOptions = 0
objSession = 0
objProtocol = 0
objSessionOptions = 0

Thanks,

-Warren.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,123
Location:
Prague, Czechia

You didn't mention that you use synchronization before.
The TransferOptions.PreserveTime = false is ignored for synchronization, unless you use SynchronizationCriteria.None or SynchronizationCriteria.Size.
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum