I am trying to use vscode remote ssh extension and connect to Linux machine that has access to my files. Vscode install the server on the Linux machine under user home directory where due to company policy I have very limited quota . Is there a way to configure vscode to install sever in other location ?
The File > Add Folder to Workspace command brings up an Open Folder dialog to select the new folder. Once a root folder is added, the Explorer will show the new folder as a root in the File Explorer. You can right-click on any of the root folders and use the context menu to add or remove folders.
The Visual Studio Code Server is a service you can run on a remote development machine, like your desktop PC or a virtual machine (VM). It allows you to securely connect to that remote machine from anywhere through a vscode. dev URL, without the requirement of SSH.
vscode-server in your home directory on the server becoming corrupted in some way. Since VS Code will automatically recreate that directory when you reconnect, it's safe to delete it.
Unfortunately there is no direct way yet with VSCode to install into a custom directory. You could follow below steps to move or install it manually into a different directory.
If your initial installation is successful
Navigate to a desired project space directory from remote desktop terminal
$ cd /your/big/disk/project/space
Move vscode-server to this area
$ mv ~/.vscode-server .
Create symlink of .vscode-server in your home directory. Use absolute paths in this command to avoid cyclic links.
$ ln -s /your/big/disk/project/space/.vscode-server ~/.vscode-server
Confirm no cyclic links with below command, it should not return anything.
$ find -L ./ -mindepth 15
Reconnect from your VSCode again. Now when VSCode looks for the remote sever in your home directory, it would be redirected to the different directory seamlessly.
If your initial installation fails (for reasons like cannot extract vscode-server on remote system due to space restriction). I had to make it work this way.
Get vscode-server commit ID on remote server using below command, which would be like 'e2d4cc38bb5da82wb67q86fd50f84h67bb340987'. Replace $COMMIT_ID with your actual commit ID from here on.
$ ls ~/.vscode-server/bin
Download tarball replacing $COMMIT_ID with the commit number from the previous step on local system. Or, if you have outbound connectivity on remote system, you could directly download it there and skip step 3.
https://update.code.visualstudio.com/commit:$COMMIT_ID/server-linux-x64/stable
Move tarball to remote server disk from local system. Below command puts it in home dir of remote system.
$ scp -P 22 vscode-server-linux-x64.tar.gz remoteID.remote.system.url.com:~/
Move tarball to large free space directory as below:
$ mkdir -p /your/big/disk/project/space/.vscode-server/bin/$COMMIT_ID/
$ mv ~/vscode-server-linux-x64.tar.gz /your/big/disk/project/space/.vscode-server/bin/$COMMIT_ID/
Extract tarball in this directory
$ cd /your/big/disk/project/space/.vscode-server/bin/$COMMIT_ID
$ tar -xvzf vscode-server-linux-x64.tar.gz --strip-components 1
Create symlink of .vscode-server in your home directory. Use absolute paths in this command to avoid cyclic links.
$ ln -s /your/big/disk/project/space/.vscode-server ~/.vscode-server
Confirm no cyclic links with below command, it should not return anything.
$ find -L ./ -mindepth 15
Connect again. Now when VSCode looks for the remote sever in your home directory, it would be redirected to the different directory seamlessly.
This has been worked out in the new version of vs-code here here, change the variable remote.SSH.serverInstallPath
through settings. Example (from tankahabir's comment)
"remote.SSH.serverInstallPath": {
"work": "/test/location",
"home": "/foobar"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With