Using Vscode to access and modify remote files is implemented in three steps: Installing Rmate on a remote Linux machine, installing OpenSSH on local windows, and installing extension remote Vscode in Vscode.
1. Install rmate on a remote Linux machine
Rmate is available in a variety of languages, in Python versions. GitHub Address: Https://github.com/sclukey/rmate-python
Download installation is simple, execute the following command in Linux
wget https://raw.githubusercontent.com/sclukey/rmate-python/master/bin/rmate chmod +x./rmatemv ./rmate/usr/local/bin/rmate
2. Install OpenSSH in the local window
GitHub Address: Https://github.com/openssl/openssl/blob/master/INSTALL
This is the need to compile their own, it is recommended to directly use the window version of the installation package: https://www.mls-software.com/opensshd.html
It is recommended to use EXE version. If you are downloading a version that is free of installation, you need to set the environment variable in Windows to the extracted bin directory. The following prompts are available when the installation finishes running the SSH command:
You can run the ssh-keygen-t TSA command directly to generate a key pair, typically the default folder in the. SSH folder in the current user directory. A password-free login to remote Linux is implemented on the Windows command line, as in the Linux system, by appending the public key id_rsa.pub file generated in Windows to the. SSH directory of the Linux login user. authorized_ Key file.
Note that if you are using a Linux login user other than the root user, you will need to modify the following. ssh folder and the permissions of the Authorized_key file, otherwise the password-free login is not possible.
chmod . SSH CD. ssh/chmod Authorized_keys
3. Installing Remote Vscode Extension
Extension Address: Https://marketplace.visualstudio.com/items?itemName=rafaelmaiolla.remote-vscode
When the installation is complete, click Start Server in the panel to start the service
After opening the terminal ("View"-"Integrated Terminal"), enter the following command:
SSH 52698:127.0. 0.1:52698 [email protected]192.168. 1.215
Rmate-p 52698 file name
Results:
You can then modify it directly.
In addition, if you want to set up an extended auto-start, simply click "Workspace Settings", which will automatically add the Setting.json file
Make the following settings in the file.
Using Vscode to access and modify remote computer files