Unable to use vscode’s remote ssh extension

I am using VSCode to set-up a remote development environment but $PATH doesn't seem to be syncing with the server.
When I use echo $PATH on the client's VSCode TERMINAL, it is displayed as:

/root/.vscode-server/cli/servers/Stable-fabdb6a30b49f79a7aba0f2ad9df9b399473380f/server/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

But using the same command on the service's VSCode TERMINAL yields the result:

/home/usrname/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

It looks like the directory /home/usrname/.cargo/bin is not in sync.
When I enter an absolute path to execute a file, I get a new error:

/home/usrname/.cargo/bin/cargo --version
error: rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured.
help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.

Is there anyone who can help?

My fault, I installed rust with a non-root user, but logged in to ssh with the root account, so I can't run it. The problem has been solved, hopefully next time not to make such a stupid mistake

1 Like