VSCode-SSH password-free connection
One, Remote-SSH plug-in
After the installation is successful, there will be a small TV on the left
Two, install git for Windows
The git installation steps are omitted here. One thing to note is the setting of environment variables.
After git is installed by default, there is only D:\Git\cmd in the environment variable; D:\Git\usr\bin needs to be added; because several .exes of ssh are in this bin path.
Three, set SSH config for configuration and connection
Click on the plus sign in the small TV on the left and
you will be asked to enter the user name and IP address of the computer you need to connect to the server (the server must be ssh enabled)
ssh yourname@yourIP //例如 ssh [email protected]
After inputting, the server you just set will come out on the left. Right-click to open the prompt to enter the password to connect successfully.
Fourth, configure the secret-free public key
1. Generate the key first under windos: Shift+right click under C:\Users\hyper.ssh, open the command line and input
ssh-keygen -t rsa -b 4096
Then you will find two files id_rsa.pub and id_rsa are generated in the .ssh folder in addition to the config file just now. id_rsa.pub is the public key, you need to copy the content inside to the file on the server.
2. Open the id_rsa.pub file with Notepad, copy the content inside, and paste it in in order to open a certain file on the server in the VSCode terminal later.
3. Enter the following command in the terminal of the server connected to VSCode just now (in order to paste the public key just now)
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys #把 id_ras.pub 中的内容粘贴进去
chmod 600 ~/.ssh/authorized_keys
sudo service ssh restart
Then there is no need to enter a password every time you enter.