Tips for password free SSH login under Linux

» 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

 Tips for password free SSH login under Linux - Geek Park

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 key ssh-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 later ssh-copy-id  root@192.168.x.xxx #If it fails, specify the file ssh-copy-id -i .ssh/id_rsa.pub  root@192.168.x.xxx

 Tips for password free SSH login under Linux - Geek Park

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 system sudo apt install putty-tools If there is no problem, run the following command Puttygen 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
 Tips for password free SSH login under Linux - Geek Park

Select the PPK file generated before in the path
 Tips for password free SSH login under Linux - Geek Park

Configure SSH

Create a new config file under the. ssh folder and write it to the following

 Host ali HostName 192.168.x.xxx Port number User User Name IdentityFile ~/.ssh/id_rsa Host liluo HostName 192.168.x.xxx Port number User User Name IdentityFile ~/.ssh/id_rsa

 Tips for password free SSH login under Linux - Geek Park

Then you can log in directly using the ssh hostname.
 Tips for password free SSH login under Linux - Geek Park

--End--

Post reply

Your email address will not be disclosed. Required items have been used * tagging

4 Replies to "Tips for password free SSH login under Linux"