Vscode connects to a remote host without entering a password

The process requires only two steps:

1. Generate a key pair on the local host

(local_host) ➜  .ssh ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/aiyolo/.ssh/id_rsa):
...
(local_host) ➜  .ssh ls
config      id_rsa      id_rsa.pub  known_hosts

2. Add id_rsa.pubthe content of the public key file to the remote host file: ~/.ssh/authorized_keys.

(remote_host) ➜  .ssh vim authorized_keys

note: This file does not exist by default and needs to be created manually. For simplicity, first connect to the remote host with a password, then edit the file with vim on the remote host, copy and paste the file content id_rsa.pubto~/.ssh/authorized_keys

Guess you like

Origin blog.csdn.net/aiyolo/article/details/126427036