[root@mayi ~]# ssh-keygen -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa.Your public key has been saved in /root/.ssh/id_rsa.pub.The key fingerprint is:SHA256:8KQyTNwu2eD07zCEYx+XT7bfK1IJ7CPbjTkVisVdPAA root@qa-lvsThe key's randomart image is:+---[RSA 2048]----+| E..o || . . + || = o .o . . . || = B = .= o || @ B S+oo o || . B +o++.+ || + .+oB || +. *.o. || . o..o. |+----[SHA256]-----+[root@mayi ~]# ssh-copy-id -i .ssh/id_rsa.pub root@192.168.10.200/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keysroot@192.168.0.200's password: Number of key(s) added: 1Now try logging into the machine, with: "ssh 'root@192.168.0.200'"and check to make sure that only the key(s) you wanted were added.[root@mayi ~]# ssh root@192.168.0.200Last failed login: Wed May 26 14:23:57 CST 2021 from 192.168.0.86 on ssh:nottyThere was 1 failed login attempt since the last successful login.Last login: Wed May 26 11:40:56 2021 from 192.168.10.23[root@mysql-master ~]#
正文
SSH认证,一步搞定
-- 展开阅读全文 --