This article is transcoded by SimpRead 简悦, original at shenshu.fun
Configured VSCode to remotely connect to the server, but every time you open the project you need to re-enter the password, which is troublesome. Below is how to enable passwordless login. After configuring VSCode remote connection to the server in the previous blog, follow these steps.
Configured VSCode to remotely connect to the server, but every time you open the project you need to re-enter the password, which is troublesome. Below is how to enable passwordless login.
After configuring VSCode remote connection to the server in the previous blog, follow these steps.
Steps are as follows:
On Windows side: >
On Windows side: #
1. Press win+R to open cmd (Command Prompt)
2. Enter the following commands in order
ssh
ssh-keygen -t rsa
# After entering the second command, keep pressing Enter
At this point, id_rsa.pub will be generated
3. Open .ssh/id_rsa.pub, you can open it with Notepad, then copy the content inside
On Linux side: >
On Linux side: #
1. Same as step 1 and 2 on Windows side
Enter the following command in Linux terminal
ssh-keygen -t rsa
Press Enter all the way through, no need to set any password.
At this point, two files are generated in user/.ssh/ directory, private key: id_rsa; public key: id_rsa.pub
2. Create the folder authorized_keys
Execute the following command in Linux terminal
vim authorized_keys
3. Paste the content copied from .ssh/id_rsa.pub on Windows side into authorized_keys on Linux side
After pasting, save and exit with :wq
Now you can connect to the server with VSCode without password!
If the above steps don’t work, you can add the following step:
Open the config file in VSCode (see previous blog)
Add the following to the configuration file:
IdentityFile ~/.ssh/id_rsa