ssh 连接linux服务器

问题1

刚开始连接新的机器时出现Linux-ssh: connect to host 192.168.1.161 port 22: Connection refused

原因:

新的机器(ubuntu 16.04)没有安装ssh服务,

解决方法
  • 安装ssh服务:sudo apt-get install openssh-server
  • 启动ssh服务:service sshd start
    然后重新运行ssh username@ip
问题2

另一台主机刚刷的linux,想通过ssh进行连接,结果出现了
Linux SSH登录服务器报ECDSA host key “ip地址” for has changed and you have requested strict checking错误

解决方法:
ssh-keygen -R "你的远程服务器ip地址"

主要原因是使用同一无线网卡,原先是放在服务器上,连接这个ip的ssh是可以的,今天把无限网卡换到另一台机器上,ip地址相同,所以本机认为连接的还是原来的服务器,因此连接失败,

参数 -R

Removes all keys belonging to hostname from a known_hosts file. This option is useful to delete hashed hosts (see the -H option above).

ssh-keygen命令用于为“ssh”生成、管理和转换认证密钥,它支持RSA和DSA两种认证密钥。

参考 :博客

发布了93 篇原创文章 · 获赞 0 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/Dream_xd/article/details/103949266