Closed tlaerm closed 3 years ago
What is the actual home directory for the root
user? E.g. what would echo ~
output, and does that path lead to a directory your user can actually access?
I've pushed a small commit (bda36c9) which you can download here (or from later builds).
Besides displaying a better warning in the output log, it also allows you to add a -CHECK_HOME
flag (see #270 on how) and it should ignore this error and default the home directory to /
instead. As long as you don't use ~
anywhere (except terminals, since those run on the server), it shouldn't affect anything anyway.
echo ~
indeed gives /root
on the server. Your patch works when I run with "-CHECK_HOME" flag.
Thank you for getting into this so quickly.
I'm still interested in what caused this. Detecting the home directory is done by running an echo Home: ~
and looking for "Home: ..." in the output, as can be seen here:
Are you using a special shell for the root user, different from sh
/bash
? (Pretty sure OpenSSH copies your user shell). What OS are you using? And just regular OpenSSH I assume, apart from running on a different port?
Sorry for the delay. So, the box uses fish as default shell. This however gives the same result to the echo Home: ~
command. I have tested again and now it works even without the flag. There is an explanation however:
After your patch I still could not connect and got another error: Unexpected packet before version
I checked issue #185 and silenced a script that was adding some ssh keys to the agent on login. After silencing the login completely, it worked. So this leads me to believe that both problems are related to this. Maybe the tryGetHome call is somehow interrupted or confused because the shell is sending some output from the login script.
Hmm, I do use the regex /^Home: (.*?)\r?\n?$/
, which would fail should anything appear before (or even after) the echo.
I'll see about merging tryGetHome
into the background command shell from #267 where it runs echo ::sshfs:home:$(echo ~)
instead and checks for the pattern in all stdout lines, making it immune to weird shell startup or weird P1
etc. Good to know login scripts can break this, thanks for discovering that.
If your login script still runs for SFTP sessions like in #185, then that's not something I can solve I think. It should run the shell non-interactively which might help configuring the script, although I'm not too sure about how the underlying ssh2
library handles SSH subsystem "shells" for e.g. SFTP.
Alright. That sounds like it should solve the problem. Ping me when you want it tested. I'll de-silence the login.
I am running into similar issue with SSH FS extension v1.24.1. When I try to log in I get an error message "Couldn't detect the home directory for 'configuration'".
My json config is:
{
"sshfs.configs": [
{
"name": "configuration",
"host": "remotehostname.org",
"username": "myusername",
"root": "/my/homedir/path",
"flags": ["CHECK_HOME"]
}
]
}
I checked that /my/homedir/path
is what I get when I echo ~
on the remote.
Could you suggest how to troubleshoot this? I haven't used this plugin before, so I might be missing something obvious.
@pelesh I think the flag needs a dash:
{
"sshfs.configs": [
{
...
"flags": ["-CHECK_HOME"]
}
]
}
I have a weird issue with one server, that has a nonstandard ssh port. When opening a terminal or trying to add the folder to workspace I get the same error:
Couldn't detect the home directory for 'configuration'
Debug output is as follows:Running on Linux Vscodium 1.57.1 vscode-sshfs v1.21.0 Host is Ubuntu 20.04 Connecting in the terminal with
ssh root@host.name -p NONSTANDARD-PORT
works fine. I'd be really grateful for any pointers. vscode-sshfs works flawlessly for other hosts.Thomas