标签归档:ssh

免口令登录远程SSH服务

切换到本地~/.ssh目录下,执行下面命令生成本地账户的RSA密钥对。需要一个公钥和一个私钥,私钥自己保留,公钥是保存在远程服务器上的。原理是,当你用ssh连接远程服务器的时候,服务器会找到对应的公钥,然后用那个公钥对一串东西进行加密,发送给客户端,客户端必须使用本地的私钥对这串东西进行解密,把结果返回给服务器,服务器核对无误,客户端便成功登录。

[email protected]:~/.ssh# ssh-keygen -trsa
Generating 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:
eb:2e:9b:ed:2b:e6:0e:d7:ad:dd:ec:50:73:20:ca:77 [email protected]
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|          . .    |
|       . . . .   |
|        S . E .  |
|       . + o o   |
|    . . o o      |
|     o++ o +     |
|     +=*B...+    |
+-----------------+

继续阅读