解决 ssh 登录到ubuntu server 慢的问题
2015-08-25 15:41
561 查看
最近在服务器上使用ubuntu系统,服务器上开启sshd服务,在客户端处使用ssh登录到服务器的时候出现卡顿的现象。
在网上搜索了解决方案,主要是:
1. 修改服务器的 /etc/ssh/sshd_config
添加 UseDNS no
2. 修改服务器的 /etc/ssh/ssh_config
添加 GSSAPIAuthentication no
然后重新启动ssh 服务, /etc/init.d/ssh restart
尝试了以上方法发现都不起作用,于是使用 ssh -v root@192.168.1.2 进行ssh登录过程跟踪,发现如下记录:
发现在 debug1: Entering interactive session. 的地方会卡顿几十秒。
登录成功以后,系统给出登陆后的信息:
上面的内容在其它版本中为
修改
再次ssh,这次没有了上面的update等信息了,但ssh也不卡顿了。
参考:http://yaxin-cn.github.io/Linux/solve-ssh-slow-to-ubuntu.html
在网上搜索了解决方案,主要是:
1. 修改服务器的 /etc/ssh/sshd_config
添加 UseDNS no
2. 修改服务器的 /etc/ssh/ssh_config
添加 GSSAPIAuthentication no
然后重新启动ssh 服务, /etc/init.d/ssh restart
尝试了以上方法发现都不起作用,于是使用 ssh -v root@192.168.1.2 进行ssh登录过程跟踪,发现如下记录:
debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Trying private key: /home/jason/.ssh/id_rsa debug1: Trying private key: /home/jason/.ssh/id_dsa debug1: Trying private key: /home/jason/.ssh/id_ecdsa debug1: Trying private key: /home/jason/.ssh/id_ed25519 debug1: Next authentication method: password root@192.168.1.2's password: debug1: Authentication succeeded (password). Authenticated to 192.168.1.2 ([192.168.1.2]:22). debug1: channel 0: new [client-session] debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session. debug1: Sending environment. debug1: Sending env LC_PAPER = zh_CN.UTF-8 debug1: Sending env LC_ADDRESS = zh_CN.UTF-8 debug1: Sending env LC_MONETARY = zh_CN.UTF-8 debug1: Sending env LC_NUMERIC = zh_CN.UTF-8 debug1: Sending env LC_TELEPHONE = zh_CN.UTF-8 debug1: Sending env LC_IDENTIFICATION = zh_CN.UTF-8 debug1: Sending env LANG = en_US.UTF-8 debug1: Sending env LC_MEASUREMENT = zh_CN.UTF-8 debug1: Sending env LC_TIME = zh_CN.UTF-8 debug1: Sending env LC_NAME = zh_CN.UTF-8
发现在 debug1: Entering interactive session. 的地方会卡顿几十秒。
登录成功以后,系统给出登陆后的信息:
Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 3.0.35-2508-g54750ff armv7l) * Documentation: https://help.ubuntu.com/ 495 packages can be updated. 296 updates are security updates. New release '12.10' available. Run 'do-release-upgrade' to upgrade to it. Last login: Thu Jan 1 01:05:10 1970 from 192.168.1.106
上面的内容在其它版本中为
/etc/motd中的内容,但ubuntu是动态生成该内容,生成脚本在
/etc/update-motd.d目录下,查看脚本可以是联网检测系统更新等情况。
修改
/etc/pam.d/sshd和
/etc/pam.d/login文件中的有pam_motd.so的行注释掉
#session optional pam_motd.so motd=/run/motd.dynamic noupdate #session optional pam_motd.so # [1]
再次ssh,这次没有了上面的update等信息了,但ssh也不卡顿了。
参考:http://yaxin-cn.github.io/Linux/solve-ssh-slow-to-ubuntu.html
相关文章推荐
- pdf转换成html网页的操作方法
- 曲线解决Android中对布局的截屏
- HDU 1159 Common Subsequence
- 九度oj 1188
- iOS URL缩短
- HDU - 1272 小希的迷宫(简单并查集)
- Facebook产品设计总监!设计APP时的14个必考题
- 访问pci设备中寄存器的一些方法
- DNA序列(uva-1368)
- 要从5个人中选取2个人作为礼仪,其中每个人的身高范围为160-190,要求2个人的身高差值最小(如果差值相同的话,选取其中最高的两人),以升序输出两个人的身高。
- (转)ArcGIS Server10.1地图服务属性概述
- jacaScript数组
- sql存储过程详解
- NSNumberFormatter 数字格式化输出
- 调用Config.ini类
- 404 Not Found 由来
- Java-数组
- Implicit super constructor BaseService() is undefined. Must explicitly invoke another constructor
- 计算机网络组网与配置技术—— 读书笔记3、传输介质和组网连接方法
- windows内核编程基础篇之字符串的处理