SchoofsKelvin / vscode-sshfs

Extension for Visual Studio Code: File system provider using SSH
GNU General Public License v3.0
543 stars 36 forks source link

Saving file error group permissions #213

Closed elelement closed 3 years ago

elelement commented 3 years ago

I've been posting on issue https://github.com/SchoofsKelvin/vscode-sshfs/issues/109, which is closed, but I think I'm facing the error described on it.

What I see is that you can only edit files belonging specifically to the user you configured to login in the plugin. In a normal ssh connection, through iTerm, for example, I am able to edit files using group permissions. In other words, if the user "pi" belongs to group openhab, I'll be able to edit files belonging to that group (664 permissions), even if "pi" is not the propietary. It seems to me, that this plugin is only checking that the file owner is equal to the logged in user.

Thank you for your time and your good work.


From the original post on #109:

Hello. I'm facing a similar issue, if not the same. I can edit files when logged in via terminal, but not through the plugin. This is what I'm trying to edit:

$ ls -lah rules/
total 24K
drwxr-xr-x  2 openhab openhab 4,0K ago 24 16:31 .
drwxr-xr-x 13 openhab openhab 4,0K may 18  2018 ..
-rw-rw-r--  1 openhab openhab 1,4K ago 25 11:46 device_4.rules
-rw-rw-r--  1 openhab openhab 1,5K ago 22 11:01 device_5.rules
-rw-rw-r--  1 openhab openhab 1,5K ago 22 10:08 device_6.rules
-rw-r--r--  1 openhab openhab  223 jun 22 14:15 readme.txt

I'm logging in as "pi" user and it belongs to the "openhab" group: sudo adduser pi openhab

Using vim or nano as "pi" allows me to edit the files (iTerm terminal), but the plugin doesn't. Even if I use the option "open a remote SSH terminal" it doesn't work:

There has to be something wrong with plugin. How can I enable some kind of debug log?

Thank you very much.

SchoofsKelvin commented 3 years ago

I've done some testing, trying to replicate this using my Ubuntu VM, but without luck.

The closest I got was more of a caching issue:

The extension still uses a connection where the test user wasn't part of newgroup, hence it couldn't write to the file. If I started a new SSH connection (outside vscode) or restarted VSCode (closing the "stale" connection), I could edit the file.

I assume restarting VSCode doesn't solve your issue though? At this point, the only thing I can think of is that my way of connecting somehow doesn't inherit group membership. My Ubuntu VM doesn't seem to have this issue.

elelement commented 3 years ago

Thank you for your comments. Restarting VS Code did, indeed, solve the problem. I did the group assignments after connecting the folder to my workspace.

Now, it works as expected. Thank you very much!