SchoofsKelvin / vscode-sshfs

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

EntryNotFound REMOTE_COMMANDS flag #292

Closed z5267282 closed 2 years ago

z5267282 commented 3 years ago

I tried to use the code command by enabling the REMOTE_COMMANDS flag in my user settings json file. When I use the code command 'Command sent to SSH FS extension' gets printed out, but I get an 'EntryNotFound' error.

image

How can this be fixed? Thanks

SchoofsKelvin commented 3 years ago

Can you post the SSH FS log? It is available under Output > SSH FS. While it should censor passwords/passphrases, I recommend checking it for (other) sensitive data first.

It does try to open /import/cage/5/z5267282/test.c, but fails while trying to fs.stats it. I assume your user has permission to list the files with e.g. permissions in that directory?

z5267282 commented 3 years ago

Here's the log

Logs

I am pretty sure I have permissions to write on test.c

Screen Shot 2021-09-25 at 11 42 47 pm

SchoofsKelvin commented 3 years ago

Ah, you only have a terminal open for the remote server, you didn't add it as a workspace folder? This is probably due to an old VS Code bug I wrote a specific solution for, which doesn't like accessing files for "non-folder" connections.

Can you get the latest .vsix from here and test it? You can drag the .vsix file into the Extensions pane or use the Extensions: Install from VSIX command. Don't forget to reload the window afterwards.

z5267282 commented 3 years ago

Yep that's worked perfectly:

Before I installed the .vsix if I first added the home directory of my remote server as a workspace folder, the code command would work.

And then after installing the latest .vsix the code command works even if I don't open the workspace folder first.

Thanks!

z5267282 commented 3 years ago

[Had to repost because I forgot to redact some info from the pictures]

Not sure what happened but recently I've been getting "Couldn't start terminal: Permission denied" errors when using the flag. If I remove the flag, I can connect just fine but as soon as I add the "REMOTE_COMMANDS" flag I get the error.

image

I tried installing the latest .vsix (this one https://github.com/SchoofsKelvin/vscode-sshfs/actions/runs/1276056771) but the error still persists.

This is the output of the extension

image

SchoofsKelvin commented 3 years ago

@z5267282 Do you have access to write files in /tmp? (and if not, where else? only within your home directory?)

z5267282 commented 3 years ago

I think I can write files to /tmp

image

I definitely have write access in my home directory

SchoofsKelvin commented 3 years ago

Could you try running the latest build from here (build 73 or later) and post your logs? That should show a stack trace of where exactly the Permission denied error happens.

z5267282 commented 3 years ago

Yep, I downloaded build 74 and here are the logs

Screen Shot 2021-10-04 at 2 56 03 pm

SchoofsKelvin commented 2 years ago

That error is indeed from writing to /tmp. I write to a file starting with .Kelvin_ so you'd have to use ls -a to find it.

I assume you're working on a school server with several users, including other users of this extension? The extension uses the static path /tmp/.Kelvin_sshfs (with permissions 666 which should include write), meaning that another user with REMOTE_COMMANDS enabled might've already created that file and have ownership over it. And somehow the ssh2 library might try to delete-and-recreate the file instead of just changing the contents. Only stumbled upon this potential issue while working with multiple test users myself.

I've made it that each user gets its own file (69c2370), you can check whether build 83 or later solves this for you. Assuming it is a multi-user issue.

z5267282 commented 2 years ago

Ah that's worked now I can login and the code command also works (also did not need to open remote folder still which is good).

I can also see the folder in /tmp/.Kelvin_

That's right as well, I am connecting to a uni server where each student has their own directory but I think /tmp is shared.

Screen Shot 2021-10-15 at 5 17 35 pm

Thanks,