Python small details solution (continuously updated)

2023-01-30  

Use VSCode access and modify remote files to implement in three steps: install RMate on the remote Linux machine; install OpenSSH on local Windows; install extended Remote vScode in VSCODE.

1. Install RMate on the remote Linux machine
Rmate has a lot of Chinese language versions. Here is a Python version. github address:

https://github.com/sclukey/rmate-python

download and install is relatively simple, just execute the following commands in Linux

wget https://raw.githubusercontent.com/sclukey/rmate-python/master/bin/rmate
chmod +x ./rmate
mv ./rmate /usr/local/bin/rmate

2. Install OpenSSH in local Window

github address:https://github.com/openssl/openssl/blob/master/INSTALLThis needs to be compiled by itself. It is recommended to use the Window version of the installation package directly:https://www.mls-software.com/opensshd.html

Recommended EXE version. If you download the installation version, you need to set the environment variable in Windows to decompress the BIN directory. The installation of running the SSH command will have the following prompts:
这里写图片描述

** You can directly run the SSH -Keygen -t RSA command to generate a key pair. Generally, the default folder will be in the .ssh folder in the current user directory. Implementing the remote Linux -free login in the command line of Windows, which is the same as the method in the Linux system. You can in the Authorized_Key file.

To make AUTHORIZED_KEY take effect, you need to modify the sshd_config file, mainly the following three items, you can cancel the notes **

After

vim /etc/ssh/sshd_config

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys

, execute the service SSHD RESTART command to restart the SSHD service

service sshd restart
#
cat id_rsa.pub >> authorized_keys
# Note the path of the file

Note that if the linux login user is not a root user, you need to modify the permissions of the following .ssh folders and Authorized_key files, otherwise it cannot be achieved by password -free login.

chmod 700 .ssh
cd .ssh/
chmod 600 authorized_keys

3. Install Remote VSCODE extension
这里写图片描述
Extended address:https://marketplace.visualstudio.com/items?itemName=rafaelmaiolla.remote-vscode
After the installation is complete, click the Start Server in the panel to start the service (this step is necessary)
这里写图片描述
After opening the terminal ([View] – [Integrated terminal]), enter the following command:

 ssh -R 52698:127.0.0.1:52698Login Linux Username@linuxComputer IP address# Example
ssh -R 52698:127.0.0.1:52698 [email protected]192.168.1.215
ssh -R 52698:127.0.0.1:52698 [email protected]192.168.1.215 -p 2159
# The above 2159 is the port number, just for example, SSH accesses the remote host through port 22 by default, this situation may change the port, or it may be the forwarding of the port.
#
rmate -p 52698Linux file name

这里写图片描述
The result will open the corresponding file:
这里写图片描述
** can be modified directly.

In addition, if you need to set up an expansion automatic start, just click [Working Area Settings], which will automatically add setting.json files **
这里写图片描述
In the file, set the following settings.
这里写图片描述
Finally, if a firewall is turned on, you need to open the 52698 port used.

source

Related Posts

Intent to pass data PARCLABLE, Serializable, Bundle detailed usage

javaee Learning Log (52): Response object, file download case, verification code case

MySQL InsertorUpDate is updated, and inserts in CAPPADOCIA when there is no existence

C# decimal number and ASCII code conversion XSZ

Python small details solution (continuously updated)

Random Posts

C# decimal number and ASCII code conversion XSZ

Caddy & GRPC (3) Add a reverse proxy plug -in to Caddy

nodejs knowledge point

Log4J2

webView and JS interact all methods and use