服务端设置:
1.安装ssh服务
sudo apt-get install openssh-server
2.确定ssh服务以启动
ps -e | grep ssh
3.修改ssh配置
sudo vim /etc/ssh/ssh_config
4.添加如下内容
PubkeyAuthentication yes
5.生成ssh公钥
ssh-keygen -t rsa -C xxx@xxx.com
客户端设置:
把客户端的.ssh下的id_rsa.pub公钥文件内容复制出来,
然后粘贴到服务端~/.ssh/authorized_keys文件中。
在客户端ssh登录:ssh xxxx(服务器的ip地址)
➜ ~ ssh 1xx.16.1x0.62
The authenticity of host '1xx.16.1x0.62' can't be established.
ECDSA key fingerprint is SHA256:uayJI+R1D4u5HkXkyQGjqKSxZM9UhgX1Opt/CT5ufZA.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '1xx.16.1x0.62' (ECDSA) to the list of known hosts.
Welcome to Linux Mint 18.1 Serena (GNU/Linux 4.4.0-53-generic x86_64)
* Documentation: https://www.linuxmint.com
congwiny@congwiny-mint ~ $
到此ssh免密登录成功~~