Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): # 输入要保存的密匙文件位置,直接回车 默认即可 Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): # 输入密匙的密码,可直接回车留空,也可以输入密码来进一步增强安全性(密匙+密码双重保险) Enter same passphrase again: # 重复输入一次密匙的密码 Your identification has been saved in /root/.ssh/id_rsa. # 你的私匙位置 /root/.ssh/id_rsa Your public key has been saved in /root/.ssh/id_rsa.pub. # 你的公匙位置 /root/.ssh/id_rsa.pub The key fingerprint is: 7c:25:bd:54:f5:fc:60:c0:86:c1:a0:32:7d:8a:80:c4 root@debian The key's randomart image is: +--[ RSA 2048]----+ | .o.+..o..| | o . . o o+ o.| |. E o . . .o + o| | . + + o o o.| | . . S . . .| | . | | . | | | | | +-----------------+
配置服务器公钥
配置公钥
1 2 3 4 5 6 7 8 9 10 11 12 13
cd .ssh # 进入 .ssh 目录 ls -a # . .. id_rsa id_rsa.pub # 查看当前文件夹(/root/.ssh/)下的公匙(id_rsa.pub)和私匙(id_rsa) mv id_rsa.pub authorized_keys # 重命名公匙(id_rsa.pub) ls -a # . .. authorized_keys id_rsa # 再查看一次当前文件夹(/root/.ssh/)下的公匙是否重命名成功