After creating the virtual machine--
Ssh-keygen generating public and private key pairs
-RW-------1 root root 1679 November 4 09:18 Id_rsa
-rw-r--r--1 root root 395 November 4 09:18 id_rsa.pub
Id_rsa inside is the private key information needs to be saved well.
Id_rsa.pub inside is a good public key.
Ssh-rsa aaaab3nzac1yc2eaaaadaqabaaabaqdnxrjdospi0xoe7wxzbmga/i2o1/lw0ivre3qe+ 1iot0np7vosv28yyexazkmgjtqamszztmdyfjr34gs1ycl0qg8ehlboy6djiwinxsms5r9kaski155i6ovtza6vhbmgxzmwybd1wrmc+zrtugu +e7n8qnvwctokfywel1qslldun/ghbxpnim0lq8xx0gidcbzio3bz/arvstmrs9klldu0epivxpz37jz0gog1sf610qecpqorqp68/mtwxs+ 5IIE/FTXACNNHACXZW0MSIT5PFIT8NSL5SEQRG6BJXNY8J5YQ/6OIEHC4KRSOQPSMI3L9CLQWPWONN1QLJ0IP [email protected]
Information about the user and machine name in the back
Then use Ssh-copy-id ~/.ssh/id_rsa.pub [email protected]:/root/.ssh/
Automatically creates a authorized_keys on the target machine
It will then contain information about the local PubKey:
Vim Centos02:authorized_keys
Ssh-rsa aaaab3nzac1yc2eaaaadaqabaaabaqdnxrjdospi0xoe7wxzbmga/i2o1/lw0ivre3qe+ 1iot0np7vosv28yyexazkmgjtqamszztmdyfjr34gs1ycl0qg8ehlboy6djiwinxsms5r9kaski155i6ovtza6vhbmgxzmwybd1wrmc+zrtugu +e7n8qnvwctokfywel1qslldun/ghbxpnim0lq8xx0gidcbzio3bz/arvstmrs9klldu0epivxpz37jz0gog1sf610qecpqorqp68/mtwxs+ 5IIE/FTXACNNHACXZW0MSIT5PFIT8NSL5SEQRG6BJXNY8J5YQ/6OIEHC4KRSOQPSMI3L9CLQWPWONN1QLJ0IP [email protected]
Ssh-rsa aaaab3nzac1yc2eaaaadaqabaaabaqc75ipz/ilqzb54w21edamypn3vtyiacyi1xu2b51xvcdrm+ zprgrcvwlgbzafypshjcevmc7uy4jh5pcw+rmlufm9kjzy+sqb8prixkpom3du89swc+6yit+xom2kisss+ xptdxsax9ow3hllo5uo3eppqlwkoegym0uy9hhff2hqoar5yjjuylaem2nspjgpwdlilquij8igfofjovr/ ugr4sgh3tmm83cuqmusr2g3qbbxswfvzdeel3u/bgvna4syqb3orplfcjkd4z+oaj5kcmlxy6fuzqrqdkzpfuzeozpcrfdveiqtum+ LQOJN976MTP+ZHNJJZLQSQ+E6GV [email protected]
The CENTOS02 machine contains the public key information of the CENTOS01 machine.
Then CENTOS01 machine Remote CENTOS02 can not use the password to log in directly
If you want CENTOS02 to telnet to centos01, you can perform the same command operation again CENTOS02 the machine:
Ssh-copy-id ~/.ssh/id_rsa.pub [Email protected]:/root/.ssh/
So two machines will be able to use certificates for mutual trust SSH login.
----------------------------------
Need to learn a lot, but you will be too little.
Linux Multi-host SSH trust operation---noob ....