Install Remote-SSH and configure it First open your VSCode, find Extensions, search for Remote, download the Remote-Development plug-in, and other Remote plug-ins will be automatically installed, including Remote-SSH: Go to settings, search for Next, you need to configure your Linux server address information. Press Then enter your address information: Linux installation and configuration of OpenSSH-Server Ubuntu // Uninstall first sudo apt-get remove openssh-server //Install sudo apt-get install openssh-server //Restart the sshd service sudo service ssh --full-restart //Automatically start sudo systemctl enable ssh CentOS //Install yum install -y openssl openssh-server //Restart the sshd service systemctl restart sshd.service //Automatically start systemctl enable sshd Editing the Configuration File Backing up configuration files sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.backup Editing the Configuration File sudo vim /etc/ssh/sshd_config Add the following configuration to the configuration file: Ports can be customized Login with password After saving, restart the sshd server. The restart command is given above. Connecting to SSH using a password Find the Linux server you configured: Enter the password and press Enter: Then open the folder and start writing code: Use Log in without password using key Client Configuration Make sure that ssh is installed on your local Windows operating system. ssh-keygen -t rsa -b 4096 (-b 4096 means the length of the generated RSA key pair is 4096 bits) After entering this command, we will be asked to specify the directory where the key file will be generated. You can press Enter to skip this step. The generated directory is Server-side configuration Check whether the ssh service is started netstat -ntlp | grep ssh Modify the configuration file vim /etc/ssh/sshd_config The most important thing here is that we need to configure cp id_rsa.pub authorized_keys Then set the permissions for the corresponding files chmod 700 .ssh chmod 600 .ssh/authorized_keys VS Remote-SSH plugin configuration Set up the Remote - SSH plugin configuration file for vscode: Host Aliyun HostName XXXX User XXX IdentityFile C:\Users\WINDSUN\.ssh\id_rsa Problems encountered If a pipeline error is reported, it may be the following problem
Precautions When you use the public key to connect to Linux for the first time, you may be asked to enter a password. After the connection is completed, a file known_hosts will be generated in your user's .ssh directory. This directory also contains the public and private keys id-rsa.pub and id-rsa. Then upload the public key to the server, repeat the above copy to .ssh/authorized_keys, reset the permissions, and try to connect to Linux again. You don't need to enter a password again. This is the end of this article about using VSCode's Remote-SSH to connect to Linux for remote development. For more information about VSCode's Remote-SSH to connect to Linux, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Specific usage of fullpage.js full screen scrolling
>>: How to optimize MySQL query speed
Table of contents 1. Demand Method 1 Method 2 Met...
Table of contents Methods of String Object Method...
Table of contents Preface 1. Null coalescing oper...
MySql index detailed introduction and correct use...
Preface When operating and managing Linux servers...
Special symbols Named Entities Decimal encoding S...
First check the kernel version you are using lin@...
Table of contents 1. Foreign key constraints What...
Table of contents Preface Promise chaining MDN Er...
I won't say much nonsense, let's just loo...
This article will explain the composition of the ...
MySQL 8.0: MVCC for Large Objects in InnoDB In th...
Ping www.baidu.com unknown domain name Modify the...
Table of contents 1. Initialize the map 2. Map Po...
Table of contents Step 1: Build the framework Ste...