1 切换到自己目录 
cd ~ 
2 新建.ssh目录 有 . 的目录是隐藏的,要 ls -al  参数才能看得到 
mkdir .ssh
3 进去
cd .ssh
4 以下是 xshell 版本的生成证书

 






5 在.ssh目录下
vi authorized_keys
6 把上图复制的全部内容 复制到authorized_keys这里。
7 保存
wq
8 打开/etc/ssh/sshd_config这个文件
vi /etc/ssh/sshd_config
9 搜索 /PasswordAuthentication  把 PasswordAuthentication yes 改为 PasswordAuthentication no 禁止密码登录 当然你也可以不改 也就是密码和证书 一起可以登录
10 wq 保存退出
11 重启sshd 服务然后就可以了
service sshd restart

点赞(66)

评论列表共有 0 条评论

立即
投稿
返回
顶部