请选择 进入手机版 | 继续访问电脑版
 找回密码
 注册会员
搜索

本文来自

Mac OS 综合讨论区

Mac OS 综合讨论区

订阅|关注

请添加对本版块的简短描述

297

主题

314

帖子

2343

积分

管理员

Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20

积分
2343

[教程] 使用自带的终端进行SSH,并解决输入密码不能正常登录问题

[复制链接]
40720 xiaoxiao 发表于 2015-2-21 20:40:04
本帖最后由 xiaoxiao 于 2015-2-21 22:26 编辑

Windows下我习惯用PUTTY来ssh登录,Mac直接使用Terminal即可。


ssh的一些常用命令:
使用root账号登录指定ip的服务器。下面需要把ip换成你自己服务器的ip。
ssh root@ip

如果服务器使用的不是标准端口,比如是4567端口,则是:
ssh root@ip -p 4567

MAC下还有窗口方式:
先打开一个终端,在菜单栏点选 Shell  – 新建远程连接,如下
QQ20150221-1.jpg

这时候会出新一个窗口,如下:
QQ20150221-3.jpg

选择安全Shell(ssh),输入服务器ip地址和用户名
QQ20150221-4.jpg

QQ20150221-2.jpg

如果服务器使用的不是标准端口,则可以在后面添加 -p 端口号
QQ20150221-5.jpg

例如:连接到IP地址192.168.1.1,端口号为1234。则再最后添加 -p 1234
  1. ssh root@192.168.1.1 -p 1234
复制代码


完成后在SSH菜单上点选 导出设置,在你的桌面就会看到一个你刚刚命名的 test.terminal。


或者也可以使用SecureCRT工具
Windows:
http://www.aixiaoxiao.cn/thread-137-1-1.html
Mac:
http://www.aixiaoxiao.cn/thread-177-1-1.html




有时候重装服务器再次连接,输入密码不能正常登录。提示:

Password:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
ea:24:31:8d:03:07:36:db:2f:74:15:5d:58:67:a3:5b.
Please contact your system administrator.
Add correct host key in /var/root/.ssh/known_hosts to get rid of this message.
Offending key in /var/root/.ssh/known_hosts:1
RSA host key for 192.168.1.1 has changed and you have requested strict checking.
Host key verification failed.


解决方法:
只要清除老的公钥信息就可以了。
ssh-keygen -R 192.168.1.1(你远程服务器的IP)



回复

使用道具 举报

快速回复 返回顶部 返回列表