»Technical toss»Tips for password free SSH login under Linux
When logging in to SSH, the problem of entering a password often leads to incorrect passwords. Using the private key to log in can solve the problem of errors caused by blind password entry, and can also steal some slack
preface
We all know that you can't see the password when logging in to SSH, and you can't copy and paste it. In addition, SSH passwords are generally complex, and it's very uncomfortable when you enter them. In addition, SSH login has a time limit, and after a period of time, you will be disconnected, so you need to enter the password frequently, which feels uncomfortable. So Cloud Cloud is looking for ways to steal it,Then I remembered that SSH can also use the key to log in.
method
Because Cloud Cloud uses the Linux system (not the installation force, but after the experience, because the hand is cheap when installing the system, it can't go back... just use it), and it can be used directly from the command line.
#Step 1: Generate the keyssh-keygen#There will be a. ssh folder under the personal folder. The files in the folder are the key and private key#Transfer the public key to the server, run the following directly, do not need to log in, and then you will need to enter a password, which will not be needed laterssh-copy-id root@192.168.x.xxx#If it fails, specify the filessh-copy-id -i .ssh/id_rsa.pub root@192.168.x.xxx
Log in with Putty
Putty is a very good SSH client, and it can also use the private key to log in, but its format is ppk, which is different from the general format. We have generated the private key previously, and we can convert it to the PPK format of Putty.
If the putty tool is not installed, install the tool first
#My Linux mint system belongs to the debain systemsudo apt install putty-toolsIf there is no problem, run the following commandPuttygen id_rsa path - o ssh.ppk output path - O private
Then you get the ssh.ppk file, and then you can load it into Putty. Set the login name
Select the PPK file generated before in the path
Configure SSH
Create a new config file under the. ssh folder and write it to the following
Host aliHostName 192.168.x.xxxPort numberUser User NameIdentityFile ~/.ssh/id_rsaHost liluoHostName 192.168.x.xxxPort numberUser User NameIdentityFile ~/.ssh/id_rsa
Then you can log in directly using the ssh hostname.
Now the government and some public institutions have begun to force the promotion of Linux like systems. In the future, if you want to install 13, you can't install it.