Permission Denied, Error Code 3 intermittent on reading files WinSCP says I have access to.

Advertisement

modrallm
Joined:
Posts:
1

Permission Denied, Error Code 3 intermittent on reading files WinSCP says I have access to.

We have an SFTP server for our company that is used by groups internally, providers and customers externally to swap files.

Every so often, WinSCP will give us a Permission Denied, Error Code 3 trying to download a file – even though WinSCP says we have read access to it.

WinSCP shows the remote folder as having rwxrwxr_x and every single file in the folder as having rw_r__r__

Today, it's hung up on a file called xx_val.zip.

I enabled logging and every file in that folder comes down in the log as it does in the UI:
. 2025-05-20 14:01:16.244 XX.YY;-;2174143;2025-05-20T01:02:38.000Z;3;"" [0];"" [0];rw-r--r--;0
I can download every other file in the folder but when I hit this one file I get:
. 2025-05-20 14:01:27.218 Copying 1 files/directories to local directory "C:\Users\XXX\Documents\" - total size: 2,174,143
. 2025-05-20 14:01:27.218   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: Yes; Mask: *.*
. 2025-05-20 14:01:27.218   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0
. 2025-05-20 14:01:27.218   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2025-05-20 14:01:27.218 File: '/gets/xx_val.zip' [2025-05-20T01:02:38.000Z] [2174143]
. 2025-05-20 14:01:27.218 Copying "/gets/xx_val.zip" to local directory started.
. 2025-05-20 14:01:27.218 Binary transfer mode selected.
. 2025-05-20 14:01:27.218 Checking existence of partially transferred file.
. 2025-05-20 14:01:27.218 Opening remote file.
> 2025-05-20 14:01:27.218 Type: SSH_FXP_OPEN, Size: 34, Number: 2307
> 2025-05-20 14:01:27.218 03,00,00,09,03,00,00,00,10,2F,67,65,74,73,2F,63,64,5F,76,61,6C,2E,7A,69,70,
> 2025-05-20 14:01:27.218 00,00,00,01,00,00,00,00,01,
. 2025-05-20 14:01:27.218 Sent 38 bytes
. 2025-05-20 14:01:27.218 There are 0 bytes remaining in the send buffer
. 2025-05-20 14:01:27.218 Looking for network events
. 2025-05-20 14:01:27.218 Timeout waiting for network events
. 2025-05-20 14:01:27.218 Read 4 bytes (40 pending)
. 2025-05-20 14:01:27.218 Read 40 bytes (0 pending)
< 2025-05-20 14:01:27.218 Type: SSH_FXP_STATUS, Size: 40, Number: 2052
< 2025-05-20 14:01:27.218 65,00,00,08,04,00,00,00,00,00,00,00,17,54,68,65,20,6F,70,65,72,61,74,69,6F,
< 2025-05-20 14:01:27.218 6E,20,63,6F,6D,70,6C,65,74,65,64,00,00,00,00,
. 2025-05-20 14:01:27.218 Discarding reserved response
. 2025-05-20 14:01:27.218 Waiting for another 4 bytes
. 2025-05-20 14:01:27.218 Looking for incoming data
. 2025-05-20 14:01:27.218 Looking for network events
. 2025-05-20 14:01:27.359 Detected network event
. 2025-05-20 14:01:27.359 Enumerating network events for socket 2120
. 2025-05-20 14:01:27.359 Enumerated 1 network events making 1 cumulative events for socket 2120
. 2025-05-20 14:01:27.359 Handling network read event on socket 2120 with error 0
. 2025-05-20 14:01:27.359 Received 39 bytes (0)
. 2025-05-20 14:01:27.359 Read 4 bytes (35 pending)
. 2025-05-20 14:01:27.359 Read 35 bytes (0 pending)
< 2025-05-20 14:01:27.359 Type: SSH_FXP_STATUS, Size: 35, Number: 2307
< 2025-05-20 14:01:27.359 65,00,00,09,03,00,00,00,03,00,00,00,12,50,65,72,6D,69,73,73,69,6F,6E,20,64,
< 2025-05-20 14:01:27.359 65,6E,69,65,64,2E,00,00,00,00,
< 2025-05-20 14:01:27.359 Status code: 3, Message: 2307, Server: Permission denied., Language:  
* 2025-05-20 14:01:27.359 (ETerminal) Permission denied.
* 2025-05-20 14:01:27.359 Error code: 3
* 2025-05-20 14:01:27.359 Error message from server: Permission denied.
. 2025-05-20 14:01:27.359 Asking user:
. 2025-05-20 14:01:27.359 Cannot open remote file '/gets/xx_val.zip'. ("Permission denied.
. 2025-05-20 14:01:27.359 Error code: 3
. 2025-05-20 14:01:27.359 Error message from server: Permission denied.")
I found other posts suggesting disabling the Preserve Timestamp option and setting the Ignore Permission Errors option. I tried those and got the same result as above (with changes to the log lines for options).

I found other posts saying "use putty to connect" and "use sudo to change the permissions" or "use a different client" but I have no superuser options on this public-facing shared server, so those are not something I can try.

I have no idea why WinSCP breaks on files randomly - and on those files it says it *should* have access to.

Any ideas?

Thanks
Mark

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
42,062
Location:
Prague, Czechia

Re: Permission Denied, Error Code 3 intermittent on reading files WinSCP says I have access to.

If you post a log showing successful and failed download of two files with seemingly same permissions, I can check further.
But so far it does not seem WinSCP issue. It's the server that denies you the access to the file. What kind of server is that?
Either the file is locked somehow. Or there are other permissions involved. Maybe the server uses ACL, not only the plain *nix permissions (if the presented permissions are even real).

Reply with quote

Guest

Re: Permission Denied, Error Code 3 intermittent on reading files WinSCP says I have access to.

The failure log is above, the success log will be below. It's not a server I have access to beyond the SFTP account login, so if I can't see it from the handshake headers I can't see it. It's a public server.

On every connection, every file in the listing always comes back with rw-r--r-- so it would look like I'd get read access even as an "Other" but sporadically I don't.

Here's the successful file download log:
. 2025-05-22 14:07:03.090 Listing directory "/gets".
> 2025-05-22 14:07:03.090 Type: SSH_FXP_OPENDIR, Size: 14, Number: 2059
< 2025-05-22 14:07:03.137 Type: SSH_FXP_HANDLE, Size: 10, Number: 2059
> 2025-05-22 14:07:03.137 Type: SSH_FXP_READDIR, Size: 10, Number: 2316
< 2025-05-22 14:07:03.153 Type: SSH_FXP_NAME, Size: 1399, Number: 2316
> 2025-05-22 14:07:03.153 Type: SSH_FXP_READDIR, Size: 10, Number: 2572
< 2025-05-22 14:07:03.168 Type: SSH_FXP_STATUS, Size: 17, Number: 2572
< 2025-05-22 14:07:03.168 Status code: 1
> 2025-05-22 14:07:03.168 Type: SSH_FXP_CLOSE, Size: 10, Number: 2820
...
. 2025-05-22 14:07:03.168 xx_val.control;-;25;2025-05-22T01:02:50.000Z;4;"" [0];"" [0];rw-r--r--;0
...
. 2025-05-22 14:07:30.520 Copying 1 files/directories to local directory "C:\Users\XXX\Documents\" - total size: 25
. 2025-05-22 14:07:30.520   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: Yes; Mask: *.*
. 2025-05-22 14:07:30.520   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
. 2025-05-22 14:07:30.520   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2025-05-22 14:07:30.520 File: '/gets/xx_val.control' [2025-05-22T01:02:50.000Z] [25]
. 2025-05-22 14:07:30.520 Copying "/gets/xx_val.control" to local directory started.
. 2025-05-22 14:07:30.520 Binary transfer mode selected.
. 2025-05-22 14:07:30.520 Opening remote file.
> 2025-05-22 14:07:30.520 Type: SSH_FXP_OPEN, Size: 38, Number: 3075
< 2025-05-22 14:07:30.520 Type: SSH_FXP_STATUS, Size: 40, Number: 2820
. 2025-05-22 14:07:30.520 Discarding reserved response
< 2025-05-22 14:07:30.645 Type: SSH_FXP_HANDLE, Size: 10, Number: 3075
> 2025-05-22 14:07:30.645 Type: SSH_FXP_FSTAT, Size: 14, Number: 3336
< 2025-05-22 14:07:30.692 Type: SSH_FXP_ATTRS, Size: 38, Number: 3336
> 2025-05-22 14:07:30.692 Type: SSH_FXP_READ, Size: 22, Number: 3589
< 2025-05-22 14:07:30.723 Type: SSH_FXP_DATA, Size: 34, Number: 3589
< 2025-05-22 14:07:30.739 Status code: 1
. 2025-05-22 14:07:30.739 Skipped 1 SSH_FXP_READ and 1 SSH_FXP_STATUS packets
> 2025-05-22 14:07:30.739 Type: SSH_FXP_CLOSE, Size: 10, Number: 4100
. 2025-05-22 14:07:30.739 Preserving timestamp [2025-05-22T01:02:50.000Z]
. 2025-05-22 14:07:30.739 Transfer done: '/gets/xx_val.control' => 'C:\Users\XXX\Documents\xx_val.control' [25]
. 2025-05-22 14:07:30.755 Copying finished: Transferred: 25, Elapsed: 0:00:00, CPS: 88/s
. 2025-05-22 14:07:56.179 Closing connection.
. 2025-05-22 14:07:56.179 Sending special code: 1
. 2025-05-22 14:07:56.195 Session sent command exit status 0
. 2025-05-22 14:07:56.195 Main session channel closed
. 2025-05-22 14:07:56.195 All channels closed

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
42,062
Location:
Prague, Czechia

Re: Permission Denied, Error Code 3 intermittent on reading files WinSCP says I have access to.

I'd like to see one continuous log on the Debug 2 logging level (same as your first log) that shows directory listing with the permissions, followed by at least one successful download and one failed download. With as little editing as possible. Give me names of the files I should look for.

Though as stated above, I do not think we can really help you here. You better contact the server administrator.

Reply with quote

Advertisement

You can post new topics in this forum