Vscode remote development: password-free login settings

1. vscode installation

Vscode official website download address: https://code.visualstudio.com/

insert image description here
The installation is very simple: you can install it in the default way, step by step without thinking, and it's OK

2. vscode plugin installation

(1) Chinese interface settings

insert image description here

  • Click to the left 扩展, then enter chinese, then click 安装.
  • Then press shift+ctr+p, 命令the panel will pop up, input display, then 配置显示语言select, select again 简体中文, at this time it prompts that a restart is required, click restartto complete the configuration of the Chinese interface.
    insert image description here

(2) ssh remote plug-in installation

Click the extension icon on the left, enter ssh, select Remote-SSH, and click Install.
insert image description here

  • Remote connection configuration
    insert image description here
    Click 远程连接the icon on the right, then click 设置the icon, and then select .ssh\config, configure remote connection.
    insert image description here
    You can fill it in Hostcasually; HostNamefill in the address of the remote connection device IP, Userand fill in the login 用户名, so that the configuration of the remote connection is set.

3. Password-free login

It is very troublesome to enter it every time you remotely log in to the server 密码. Next, we will introduce the method without entering a password.

Step 1 : CMDOpen the windows terminal and enter the following code to generate秘钥

ssh-keygen -t rsa -b 4096

The option to be selected pops up, just press EnterEnter. After the key is generated, the terminal will display 秘钥the storage address as follows:
insert image description here

Find the key file saved in the C drive according to the path id_rsa.pub, as follows:
insert image description here

Step 2 : Log in to the linux server and create .ssha folder under the home directory (/home/yuanwushui(username))

mkdir .ssh
  • Place windowsthe generated , uploaded under folder 秘钥文件:id_rsa.pubon the server ..ssh
  • It can be uploaded by scp or any other method. The method of scp upload is as follows:
cd .ssh
scp id_rsa.pub  [email protected]:.ssh/  # yuanwushui 为用户名  10.0.8.21 是远程服务器的ip  

insert image description here
Step 3 : .sshCreate authorized_keysa directory under the server directory, execute the following script to create

cat id_rsa.pub  >> authorized_keys

insert image description here

Step 4 : Log in to the remote again in vscode, and you can log in to the remote without a password at this time

Guess you like

Origin blog.csdn.net/weixin_38346042/article/details/130566805