in Linux system Management, it is the most common method to set up password-free login and make the machine batch management. For example, for dozens of or even hundreds of online machines, usually we will set up a "publishing machine" as a central control machine to the other online machine password-free login, and then the software, configuration file distribution, update, deployment. Of course, for the above problem, the solution is not optimal and unique, such as you can use expect analog automatic input to complete the automatic login verification process, or use some open source software now to automate the configuration and deployment tools, such as Puppet, but this is not in the scope of this article, What we are going to talk about today is the most primitive, most effective and direct way: password-free login.
Environment: Host a Godben 192.168.1.26
Host B godben2 192.168.1.30
To operate on host a:
[[email protected] ~]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter passphrase (empty for no passphrase): (ignore: Direct carriage return) Enter same passphrase again: (Ignore: Direct carriage return) Your identification has been saved in /home/miao/.ssh/id_rsa. your public key has been saved in /home/miao/.ssh/id_rsa.pub.
[Email protected] ~]# ssh-copy-id-i ssh/id_rsa.pub [email protected] Password:now try logging into the machine, with "SSH" [e-mail protected] ' ", and check in:. Ssh/authorized_keys to make sure we haven ' t added extra keys You weren ' t expecting.
To operate on Host B:
[[email protected] ~]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter passphrase (empty for no passphrase): (ignore: Direct carriage return) Enter same passphrase again: (Ignore: Direct carriage return) Your identification has been saved in /home/miao/.ssh/id_rsa. your public key has been saved in /home/miao/.ssh/id_rsa.pub.
[Email protected] ~]# ssh-copy-id-i ssh/id_rsa.pub [email protected] Password:now try logging into the machine, with "SSH" [e-mail protected] ' ", and check in:. Ssh/authorized_keys to make sure we haven ' t added extra keys You weren ' t expecting.
Test:
Operation on Host A: Ssh-l root 192.168.1.30
Operate on Host B: Ssh-l root 192.168.1.26
This article is from the "Godben" blog, make sure to keep this source http://godben.blog.51cto.com/8919725/1696308
SSH dual-Machine Trust building