michaellukashov / Far-NetBox

SFTP/SCP/FTP/FTPS/WebDAV/S3 client for Far Manager 3 (http://farmanager.com/)
https://forum.farmanager.com/viewtopic.php?t=6317
GNU General Public License v2.0
158 stars 52 forks source link

Error changing file permission over SFTP connection #268

Open SkippiCZ opened 6 years ago

SkippiCZ commented 6 years ago

Far Manager, version 3.0 (build 5100) x64 NetBox Version 2.4.5 (Build 531) (OS 10.0.16299 - Windows 10 Pro) Connection to SSH server on Red Hat Enterprise Linux 2.6.32-642.11.1.el6.x86_64 I tried to change permission of file "test.sh" - for example from "rwxr--r--" to "rw-r--r--", but FAR reported error:

╔═══════════════════ Error ════════════════════╗
║ Cannot change properties of file 'test.sh'.  ║
╟──────────────────────────────────────────────╢
║ Permission denied.                           ║
║ Error code: 3                                ║
║ Error message from server:                   ║
╟──────────────────────────────────────────────╢
║       Abort   Retry   Skip   Skip all        ║
╚══════════════════════════════════════════════╝

But I can see (on OS level and also after re-read directory in FAR), that permission of the file has changed. The same operation is working over FTP connection. Here you can see part of LOG file: . 2018-05-02 12:33:56.325 test.sh;-;189;2018-04-24T13:30:08.000Z;3;"pdsadm115" [512];"pdstage115" [512];rwxr--r--;0 . 2018-05-02 12:33:56.326 Startup conversation with host finished. . 2018-05-02 12:33:58.525 Detected network event . 2018-05-02 12:33:58.525 Received 13 bytes (0) . 2018-05-02 12:34:23.259 Changing properties of "test.sh" (No) . 2018-05-02 12:34:23.259 - mode: "u+rw-xs,g+r-wxs,o+r-wxt" . 2018-05-02 12:34:23.259 - group: "pdstage115" [0] . 2018-05-02 12:34:23.259 - owner: "pdsadm115" [0]

2018-05-02 12:34:23.259 Type: SSH_FXP_LSTAT, Size: 32, Number: 10503 . 2018-05-02 12:34:23.259 Sent 36 bytes . 2018-05-02 12:34:23.259 There are 0 bytes remaining in the send buffer . 2018-05-02 12:34:23.259 Read 4 bytes (9 pending) . 2018-05-02 12:34:23.259 Read 9 bytes (0 pending) < 2018-05-02 12:34:23.259 Type: SSH_FXP_STATUS, Size: 9, Number: 10244 . 2018-05-02 12:34:23.259 Discarding reserved response . 2018-05-02 12:34:23.259 Waiting for another 4 bytes . 2018-05-02 12:34:23.285 Detected network event . 2018-05-02 12:34:23.285 Received 41 bytes (0) . 2018-05-02 12:34:23.285 Read 4 bytes (37 pending) . 2018-05-02 12:34:23.285 Read 37 bytes (0 pending) < 2018-05-02 12:34:23.285 Type: SSH_FXP_ATTRS, Size: 37, Number: 10503 2018-05-02 12:34:23.285 Type: SSH_FXP_SETSTAT, Size: 48, Number: 10761 . 2018-05-02 12:34:23.285 Sent 52 bytes . 2018-05-02 12:34:23.285 There are 0 bytes remaining in the send buffer . 2018-05-02 12:34:23.285 Waiting for another 4 bytes . 2018-05-02 12:34:23.311 Detected network event . 2018-05-02 12:34:23.311 Received 13 bytes (0) . 2018-05-02 12:34:23.311 Read 4 bytes (9 pending) . 2018-05-02 12:34:23.311 Read 9 bytes (0 pending) < 2018-05-02 12:34:23.311 Type: SSH_FXP_STATUS, Size: 9, Number: 10761 < 2018-05-02 12:34:23.311 Status code: 3, Message: 10761, Server: , Language: . 2018-05-02 12:34:23.311 Asking user: . 2018-05-02 12:34:23.311 Cannot change properties of file 'test.sh'. ("Permission denied. . 2018-05-02 12:34:23.311 Error code: 3 . 2018-05-02 12:34:23.311 Error message from server: ")

SkippiCZ commented 6 years ago

The same operation is running fine under WinSCP version 5.13.1 (Build 8265): . 2018-05-03 14:35:37.404 Changing properties of "test.sh" (No) . 2018-05-03 14:35:37.404 - mode: "u+rwx-s,g+r-wxs,o+r-wxt"

2018-05-03 14:35:37.404 Type: SSH_FXP_LSTAT, Size: 32, Number: 1543 2018-05-03 14:35:37.404 07,00,00,06,07,00,00,00,17,2F,68,6F,6D,65,2F,70,64,73,61,64,6D,31,31,35,2F, 2018-05-03 14:35:37.404 74,65,73,74,2E,73,68, . 2018-05-03 14:35:37.405 Sent 36 bytes . 2018-05-03 14:35:37.405 There are 0 bytes remaining in the send buffer . 2018-05-03 14:35:37.405 Looking for network events . 2018-05-03 14:35:37.405 Timeout waiting for network events . 2018-05-03 14:35:37.405 Read 4 bytes (24 pending) . 2018-05-03 14:35:37.405 Read 24 bytes (0 pending) < 2018-05-03 14:35:37.405 Type: SSH_FXP_STATUS, Size: 24, Number: 1284 < 2018-05-03 14:35:37.405 65,00,00,05,04,00,00,00,00,00,00,00,07,53,75,63,63,65,73,73,00,00,00,00, . 2018-05-03 14:35:37.405 Discarding reserved response . 2018-05-03 14:35:37.405 Waiting for another 4 bytes . 2018-05-03 14:35:37.405 Looking for incoming data . 2018-05-03 14:35:37.405 Looking for network events . 2018-05-03 14:35:37.430 Detected network event . 2018-05-03 14:35:37.430 Enumerating network events for socket 1976 . 2018-05-03 14:35:37.430 Enumerated 1 network events making 1 cumulative events for socket 1976 . 2018-05-03 14:35:37.430 Handling network read event on socket 1976 with error 0 . 2018-05-03 14:35:37.430 Received 41 bytes (0) . 2018-05-03 14:35:37.430 Read 4 bytes (37 pending) . 2018-05-03 14:35:37.430 Read 37 bytes (0 pending) < 2018-05-03 14:35:37.430 Type: SSH_FXP_ATTRS, Size: 37, Number: 1543 < 2018-05-03 14:35:37.430 69,00,00,06,07,00,00,00,0F,00,00,00,00,00,00,00,BD,00,00,02,00,00,00,02,00, < 2018-05-03 14:35:37.430 00,00,81,A4,5A,EA,69,D1,5A,DF,31,60, 2018-05-03 14:35:37.430 Type: SSH_FXP_SETSTAT, Size: 40, Number: 1801 2018-05-03 14:35:37.430 09,00,00,07,09,00,00,00,17,2F,68,6F,6D,65,2F,70,64,73,61,64,6D,31,31,35,2F, 2018-05-03 14:35:37.430 74,65,73,74,2E,73,68,00,00,00,04,00,00,01,E4, . 2018-05-03 14:35:37.430 Sent 44 bytes . 2018-05-03 14:35:37.430 There are 0 bytes remaining in the send buffer

It seems, that NetBox is trying to change owner and group also and use incorrect id (0 instead of 512).

If I try to change also group (from 512=pdstage115 to 0=root) for file, WinSCP failed with the same error: Permission denied. Error code: 3 Error message from server: Permission denied

See LOG file from WinSCP: . 2018-05-03 14:53:43.011 Changing properties of "test.sh" (No) . 2018-05-03 14:53:43.011 - mode: "u+rw-xs,g+r-wxs,o+r-wxt" . 2018-05-03 14:53:43.011 - group: "root" [0]

2018-05-03 14:53:43.011 Type: SSH_FXP_LSTAT, Size: 32, Number: 1543 . 2018-05-03 14:53:43.011 Sent 36 bytes . 2018-05-03 14:53:43.011 There are 0 bytes remaining in the send buffer . 2018-05-03 14:53:43.011 Read 4 bytes (24 pending) . 2018-05-03 14:53:43.011 Read 24 bytes (0 pending) < 2018-05-03 14:53:43.011 Type: SSH_FXP_STATUS, Size: 24, Number: 1284 . 2018-05-03 14:53:43.011 Discarding reserved response . 2018-05-03 14:53:43.011 Waiting for another 4 bytes . 2018-05-03 14:53:43.037 Detected network event . 2018-05-03 14:53:43.037 Received 41 bytes (0) . 2018-05-03 14:53:43.037 Read 4 bytes (37 pending) . 2018-05-03 14:53:43.037 Read 37 bytes (0 pending) < 2018-05-03 14:53:43.037 Type: SSH_FXP_ATTRS, Size: 37, Number: 1543 2018-05-03 14:53:43.037 Type: SSH_FXP_SETSTAT, Size: 48, Number: 1801 . 2018-05-03 14:53:43.037 Sent 52 bytes . 2018-05-03 14:53:43.038 There are 0 bytes remaining in the send buffer . 2018-05-03 14:53:43.038 Waiting for another 4 bytes . 2018-05-03 14:53:43.063 Detected network event . 2018-05-03 14:53:43.063 Received 38 bytes (0) . 2018-05-03 14:53:43.063 Read 4 bytes (34 pending) . 2018-05-03 14:53:43.063 Read 34 bytes (0 pending) < 2018-05-03 14:53:43.063 Type: SSH_FXP_STATUS, Size: 34, Number: 1801 < 2018-05-03 14:53:43.063 Status code: 3, Message: 1801, Server: Permission denied, Language:
. 2018-05-03 14:53:43.063 Asking user: . 2018-05-03 14:53:43.063 Cannot change properties of file 'test.sh'. ("Permission denied. . 2018-05-03 14:53:43.063 Error code: 3 . 2018-05-03 14:53:43.063 Error message from server: Permission denied")

VictorVG commented 6 years ago

Access denied - see server settings.

martinprikryl commented 6 years ago

As OP showed, the same works in WinSCP application. And I actually suffer from the same problem too, when I use your plugin. It's clearly a bug in the plugin.

VictorVG commented 6 years ago

martinprikryl

Personally, I do not understand you - the phenomenon is reproduced and WinSCP - it is written in the log about the prohibition of access from the server, and in the NetBox, and because of your fault NetBox for WinSCP "by definition, there can be no errors," and "in NetBox sits an error ". Yes, there are errors introduced from WinSCP, but they are perfectly reproduced in it. Autumn after the "changes" in v5.10.3 Beta where WinSCP authors decided that the standards specifications should comply with everything, but only they did not break the work with the URL and FTP protocol.

SkippiCZ commented 6 years ago

Change of file permissions only (without change of group or owner) is working in WinSCP, but failed in NetBox. It seems that NetBox trying to change also group and owner, even when I did not changed it in properties.

9-11 commented 6 years ago

You can use this patch to resolve the issue patch3.txt