How to ignore permissions

Advertisement

Dan Curious
Donor
Joined:
Posts:
44
Location:
NY

How to ignore permissions

Hi,

I'm getting the standard message, but can't figure out how to ignore permissions.
Upload of file 'XXXXX' was successful, but error occurred while setting the permissions and/or timestamp.

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.")
This is the VBScript code for setting the transfer options. The returned object is then used in PutFiles(). I don't remember why we are using RawSettings; I think it's because a straight assignment like
TransferOptions_obj.Permissions = False
doesn't work. That was some time back.

Function wscp_GetTransferOptions
    Dim TransferOptions_obj
 
    Set TransferOptions_obj = WScript.CreateObject( "WinSCP.TransferOptions" )
    ' TransferOptions_obj.OverwriteMode = OverwriteMode_Overwrite
    ' TransferOptions_obj.PreserveTimestamp = False
    ' TransferOptions_obj.Permissions = False
    ' TransferOptions_obj.AddRawSettings "PreserveTimeDirs", 1
    TransferOptions_obj.AddRawSettings "IgnorePermErrors", 1
    TransferOptions_obj.AddRawSettings "PreserveTimestamp", 0
 
    If Err.number  <> 0 Then
        Transfer_Succeeded_b = False
        ErrorNumber = Err.number
        ErrorDescription = Err.Description
        ErrorSource = Err.Source
        Err.Clear
 
        Call udfs_LogError( "Problem with Transfer options", ErrorNumber, ErrorDescription, ErrorSource )
    End If
 
    Set wscp_GetTransferOptions = TransferOptions_obj
End Function

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,567
Location:
Prague, Czechia

Re: How to ignore permissions

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Also show us how are you using wscp_GetTransferOptions with PutFiles.
Also check https://winscp.net/eng/docs/faq_library_parameters

Reply with quote

Dan Curious
Donor
Joined:
Posts:
44
Location:
NY

We downloaded the latest copy of the COM component, and Unregistered the existing component.

When we try to register again, we get an error with both the 32-bit and the 64-bit version:
c:\windows\microsoft.NET\Framework64\v4.0.30319\RegAsm.exe WinSCPnet.dll /codebase /tlb
Microsoft .NET Framework Assembly Registration Utility version 4.8.3752.0
for Microsoft .NET Framework version 4.8.3752.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Types registered successfully
RegAsm : error RA0000 : An error occurred while saving the exported type library: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
We're in Admin mode, at the command prompt. Should we reboot?

Yep, we generate the .LOG files daily.

What the most recent version of the COM component of WinSCP? We have
WinSCPNet.dll 1/26/2021, 8:07 am

Reply with quote

martin
Site Admin
martin avatar

It's possible that the type library file is locked, so yes, reboot can help.

1/26/2021 is definitely not the latest version of WinSCP. The latest version, 5.19.2, was released on 2021-07-27.

Reply with quote

Advertisement

Dan Curious
Donor
Joined:
Posts:
44
Location:
NY

We haven't resolved this, yet. Because of the

"...was successful, but error occurred..." error,

we keep getting false positive when determining whether a transmission took place.

The log says the command line is interpreted as
     "put  -nopermissions -preservetime -transfer="binary" -rawtransfersettings[3] IgnorePermErrors="1" PreserveTimestamp="0" Permissions="0""
What are we doing wrong?

This is the transfer code we're using:
TransferOptions_obj.TransferMode = 0
TransferOptions_obj.AddRawSettings "IgnorePermErrors", "1"
TransferOptions_obj.AddRawSettings "PreserveTimestamp", "0"
TransferOptions_obj.AddRawSettings "Permissions", "0"

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,567
Location:
Prague, Czechia

It seems that your server does not support preserving timestamps:
< 2021-08-16 06:30:43.390 Type: SSH_FXP_STATUS, Size: 40, Number: 1033
< 2021-08-16 06:30:43.391 Status code: 8, Message: 1033, Server: Operation unsupported, Language: en
* 2021-08-16 06:30:43.393 (ETerminal) The server does not support the operation.
So you need to uncomment the:
TransferOptions_obj.PreserveTimestamp = False

Reply with quote

Dan Curious
Donor
Joined:
Posts:
44
Location:
NY

Looks good. There was no error flagged from this script:
transferResult.Check
 
Result_x = transferResult.IsSuccess()
 
If Err.number  <> 0 Then
   Transfer_Succeeded_b = False
   ErrorNumber = Err.number
   ErrorDescription = Err.Description
   ErrorSource = Err.Source
   Err.Clear
   Call udfs_LogError( "Problem Transferring " & File_From_s & " to " & File_To_s, ErrorNumber, ErrorDescription, ErrorSource )
   Call udfs_SendErrorMessage( "Problem Transferring " & File_From_s & " to " & File_To_s, ErrorNumber, ErrorDescription, ErrorSource )
 
End If
But there was also no 'successful' string in the WinSCP log file.

In the WinSCP log (attached), does the Zero exit code in
. 2021-08-24 07:03:24.865 Script: Exit code: 0
mean that the transmission was successful?

Reply with quote

Advertisement

martin
Site Admin
martin avatar

You can tell that the transfer was successful by inspecting the TransferOperationResult.IsSuccess – what you are already doing. The log file shall not be used for any decisions.

Reply with quote

Advertisement

You can post new topics in this forum