在用户目录的.ssh的目录下执行命令ssh-keygen -t rsa,会生成两个文件id_rsa id_rsa.pub,执行命令cat id_rsa.pub >>authorized_keys
chmod 700 /home/lishaoyu/.ssh 一定要有这个啊,教训
chmod 600 authorized_keys
执行命令vim /etc/ssh/sshd_config
Protocol 2 /仅允许使用SSH2
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
重启ssh服务:service sshd restart
将id_rsa文件拷贝到PC电脑上,