当前位置:网站首页>SSH password free login

SSH password free login

2022-06-21 12:36:00 2022 Chongya

linux To configure ssh Password free login :

explain :ssh The security shell for remote login has identity authentication mechanism :

       —— user name + password

       —— Key login

   Introduction to the environment :

            host1:156.3.203.128

            host2:156.3.203.251


1. stay host1 Generate public key under host / Private key pair

Execute the following command , Keep going back

[[email protected] ~]# ssh -keygen -t rsa

After command execution , stay /home/user Lower generation .ssh Catalog ,.ssh Directory is id_rsa and id_rsa.pub Two documents .

2、 take host1 Under the main engine id_rsa.pub Copied to the host2 Under the main engine

There is no password free login at this time , So enter host2 Password

3、host2 The host must copy the id_rsa.pub The contents of the file are added to /home/user/.ssh/authorzied_keys In file

     Need modification authorized_keys The permission of the file is 600

testing :

Now? host1 The host can log in without password host2 The main engine

explain : The first 2、3 Step can be done with one command :ssh-copy-id 192.168.0.11

summary : The logged in machine can have a private key , The logged in machine must have the public key of the logged in machine . This public key / The private key pair is usually generated on the private key host .
It's for rsa The public key of the algorithm / Private key pair , You can also use it dsa( The corresponding file is id_dsa,id_dsa.pub)
Want to make host1,host2 Mutual login without password , that host2 The host can be configured in the same way as above
 

原网站

版权声明
本文为[2022 Chongya]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206211230058398.html