Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): //这里表示秘钥存放地点,直接回车
Created directory '/root/.ssh'. //默认创建/root/.ssh以保存秘钥
Enter passphrase (empty for no passphrase): //输入密钥密码,可以直接回车
Enter same passphrase again: //重复密钥密码,可以直接回车
Your identification has been saved in /root/.ssh/id_rsa. //提示公钥和私钥已经存放在/root /.ssh/目录下
Your public key has been saved in /root/.ssh/id_rsa.pub.
#cd /root/.ssh/
# ls
id_rsa.pub id_rsa //可以看到两个秘钥,将这两个保存好,将私钥拷贝到本地
#mv id_rsa.pub authorized_keys //将公钥改名为authorized_keys
#chmod 600 /root/.ssh/authorized_keys //修改秘钥的权限,600表示属主有rw权限
当然如果本地自己是用linux则生成的秘钥,要将公钥拷贝到vps上,并修改名字和权限
#scp id_rsa.pub root@192.168.10.1:/root/.ssh
#mv id_rsa.pub authorized_keys //这里是改名字,是在/root/.ssh目录下操作