4.3 进行ssh的密钥连接-在Ubuntu下制作密钥 4.3.1 在Linux下生成密钥
在命令行下运行:
> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/compilers/.ssh/id_rsa): #输入私钥保存地址
Enter passphrase (empty for no passphrase): #输入私钥密码
Enter same passphrase again: #确认密码
Your identification has been saved in /home/compilers/.ssh/id_rsa.
Your public key has been saved in /home/compilers/.ssh/id_rsa.pub.
The key fingerprint is:
e7:f6:98:57:f0:d9:93:54:30:76:9f:10:09:c0:f8:b9 compilers@compilers-vm
The key's randomart image is:
+--[ RSA 2048]----+
| o....o*..|
| . . o.o+|
| . . .o|
| o . . |
| S o o.o.|
| E +o.|
| o . .|
| . +. |
| o.. |
+-----------------+
4.3.2 把公钥写入authorized_keys文件中> cd ~/.ssh
> cat id_rsa.pub >> quthorized_keys #需要换行加入新的内容
4.3.3 生成putty私钥1. 把id_rsa传到windows系统上。
2. 使用puttygen的"Load private key"读取id_rsa文件,并输入私钥密码:
文本框里的内容应该和id_rsa.pub中的一致。点击"Save private key"保存私钥。
4.3.4 使用putty进行密钥登录那就是和之前一样的操作: