修改服务器配置
vim /etc/ssh/sshd_config
默认配置不变append选项
PermitRootLogin yes
PasswordAuthentication yes
UseDNS no
修改客户端
在客户端使用ssh-keygen生成RSA秘钥对
id_rsa
id_rsa.pub
id_rsa文件保存在本机 ~/.ssh/
使用ftp把id_rsa.pub上传到服务器端后执行
追加id_rsa.pub文本到需要登陆的用户目录/.ssh/authorized_keys文件中
比如root用户,其他/home/user
cat id_rsa.pub>>~/.ssh/authorized_keys
重新链接
ssh root@192.168.1.10
The authenticity of host ‘192.168.1.10 (192.168.1.10)’ can’t be established.
ECDSA key fingerprint is SHA256:KbGgWlzTk56lc0O1tyi7bSPR********************.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
不要选择默认,输入yes
可能是服务器是本机虚拟机上的原因吧,只能这样才能登陆。