Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does VSCode connect to Linux remotely?

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how VSCode connects to Linux remotely. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. VSCode remote connection steps

1. Install the plug-in

After opening VSCode, use the shortcut key Ctrl+Shift+X or use the following icon to search for ssh to install

2. Configure the remote server

After installation, the button in the lower left corner will appear, and the option on the right will appear to configure the remote server in the settings.

3. Configure the file of config

Select the first line, the following information appears, and fill in according to the format

Host: the name of the custom remote connection

Hostname: server IP address

User: user name

After saving, press the button below and you can use it happily.

2. The use of keys

For VSCode remote connection to the Linux server, whether to use the key, we can know in the above steps, when we choose a different directory to open, we will always remind us to re-enter the password, when using the key, there is no need to re-use the login password (the same is true when using git).

1. Configure the key

On the command line, enter the following command:

Ssh-keygen-t rsa-C 'rumenz@qq.com'

Two files are generated under the user's home directory, one of which is the private key and the other is the public key (suffix pub). Copy the contents with the suffix pub to the Linux home directory ~ /. Ssh/authorized_keys, that is, you no longer need to write a password every time you log in.

2. Basic use of keys

The main keyword of the command used to configure the key is ssh-keygen

The ssh-keygen command is used to generate, manage, and transform authentication keys for "ssh". It supports both RSA and DSA authentication keys. The SSH key is retained by default in the ~ / .ssh directory. If there is no ~ / .ssh directory, the ssh-keygen command creates one with the correct permissions. A pair of keys is generated, one of which is the public key and the other is the private key. The public key can be placed on the remote server. In the case of multiple SSH key management, you need to specify the key file name. In this case, you need to configure ssh config to prevent multiple public keys from finding the corresponding private key.

Common keyword options:

-b: specify the key length

-f: specify the file name to save the key

-t: specifies the type of key to create.

-C: add comment

Using ssh-kengen will generate two files under the ~ / .ssh / directory. When the file name and key type are not specified, the two files generated by default are:

The first id_rsa is the private key file.

The second one of id_rsa.pub is the public key file

Basic example:

> ssh-keygen-m PEM-t rsa-b 4096

4096-bit SSH RSA public and private key files are generated by default in the ~ / .SSH RSA directory. If an SSH key pair exists at the current location, these files will be overwritten.

Ssh-keygen-t rsa-C 'rumenz@qq.com'-f ~ / .ssh/github_id_rsa

Generate github_id_rsa public and private key files in the ~ / .ssh directory. If an SSH key pair exists at the current location, these files will be overwritten. It is also possible to determine later that the file path is rewritten.

3. Configure key config

Thank you for reading! This is the end of this article on "how to remotely connect VSCode to Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report