最后更新时间:2018-10-25 10:05:58
使用VNC或服务器账号密码连接Linux实例。 打开终端,输入以下指令,查看是否已经生成SSH秘钥。 ls -al ~/.ssh # Lists the files in your .ssh directory, if they exist 如果有文件id_rsa.pub 或 id_dsa.pub 说明已经创建过SSH密钥,导入即可。
生成新的SSH密钥。 [root@host ~]$ ssh-keygen <== 建立密钥对 Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): <== 按 Enter Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): <== 输入密钥锁码,或直接按 Enter 留空 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: xxxxxxx
创建完成,安装公钥。 设置SSH,打开密钥登录。 |