linux下SSH远程连接服务慢解决方案
1、适用命令及方案如下:
【远程连接及执行命令】
ssh -p22root@10.0.0.19
ssh -p22 root@10.0.0.19 /sbin/ifconfig
【远程拷贝:推送及拉取】
scp -P22 -r -p /etc root@10.0.0.19:/tmp/
scp -P22 -r -p root@10.0.0.19:/tmp/ /etc
【安全的FTP功能】
sftp -oPort=22 root@10.0.0.19
【无密码验证方案】
例如利用sshkey批量分发文件,执行部署操作。
2、连接慢的主要原因是DNS解析导致
解决方法:
1、在ssh服务端上更改/etc/ssh/sshd_config文件中的配置为如下内容:
UseDNS no
# GSSAPI options
GSSAPIAuthentication no
然后,执行/etc/init.d/sshd restart重启sshd进程使上述配置生效,在连接一般就不慢了。
2、如果还慢的话,检查ssh服务端上/etc/hosts文件中,127.0.0.1对应的主机名是否和
uname -n的结果一样,或者把本机ip和hostname(uname -n结果)加入到/etc/hosts里。
| 
 1 
2 
3 
4 
5 
6 
7 
8 
 | 
[root@C64 ~]# uname -nC64[root@C64 ~]# cat /etc/hosts#modi by oldboy 11:12 2013/9/24127.0.0.1   C64 localhost localhost.localdomain localhost4 localhost4.localdomain4::1         localhost localhost.localdomain localhost6 localhost6.localdomain610.0.0.18   C64################ | 
3、利用ssh-v的调试功能查找慢的原因
其实可以用下面的命令调试为什么慢的细节(学习这个思路很重要)。
| 
 1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
 | 
[root@C64 ~]# ssh -v root@10.0.0.19OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010debug1: Reading configuration data /etc/ssh/ssh_configdebug1: Applying options for *debug1: Connecting to 10.0.0.19 [10.0.0.19] port 22.debug1: Connection established.debug1: permanently_set_uid: 0/0debug1: identity file /root/.ssh/identity type -1debug1: identity file /root/.ssh/id_rsa type -1debug1: identity file /root/.ssh/id_dsa type -1debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3debug1: match: OpenSSH_4.3 pat OpenSSH_4*debug1: Enabling compatibility mode for protocol 2.0debug1: Local version string SSH-2.0-OpenSSH_5.3debug1: SSH2_MSG_KEXINIT sentdebug1: SSH2_MSG_KEXINIT receiveddebug1: kex: server->client aes128-ctr hmac-md5 nonedebug1: kex: client->server aes128-ctr hmac-md5 nonedebug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sentdebug1: expecting SSH2_MSG_KEX_DH_GEX_GROUPdebug1: SSH2_MSG_KEX_DH_GEX_INIT sentdebug1: expecting SSH2_MSG_KEX_DH_GEX_REPLYThe authenticity of host '10.0.0.19 (10.0.0.19)' can't be established.RSA key fingerprint is ca:18:42:76:0e:5a:1c:7d:ef:fc:24:75:80:11:ad:f9.Are you sure you want to continue connecting (yes/no)? yes=======>老男孩老师评:这里就是提示保存密钥的交互提示。Warning: Permanently added '10.0.0.19' (RSA) to the list of known hosts.debug1: ssh_rsa_verify: signature correctdebug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug1: SSH2_MSG_NEWKEYS receiveddebug1: SSH2_MSG_SERVICE_REQUEST sentdebug1: SSH2_MSG_SERVICE_ACCEPT receiveddebug1: Authentications that can continue: publickey,passworddebug1: Next authentication method: publickeydebug1: Trying private key: /root/.ssh/identitydebug1: Trying private key: /root/.ssh/id_rsadebug1: Trying private key: /root/.ssh/id_dsadebug1: Next authentication method: passwordroot@10.0.0.19's password:=======>老男孩老师评:这里就是提示输入密码的交互提示。debug1: Authentication succeeded (password).debug1: channel 0: new [client-session]debug1: Entering interactive session.debug1: Sending environment.debug1: Sending env LANG = en_US.UTF-8Last login: Tue Sep 24 10:30:02 2013 from 10.0.0.18在远程连接时如果慢就可以确定卡在哪了。[root@C64_A ~]# ssh -v oldboy@10.0.0.17OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010debug1: Reading configuration data /etc/ssh/ssh_configdebug1: Applying options for *debug1: Connecting to 10.0.0.17 [10.0.0.17] port 22.debug1: Connection established.debug1: permanently_set_uid: 0/0debug1: identity file /root/.ssh/identity type -1debug1: identity file /root/.ssh/id_rsa type -1debug1: identity file /root/.ssh/id_dsa type 2debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3debug1: match: OpenSSH_5.3 pat OpenSSH*debug1: Enabling compatibility mode for protocol 2.0debug1: Local version string SSH-2.0-OpenSSH_5.3debug1: SSH2_MSG_KEXINIT sentdebug1: SSH2_MSG_KEXINIT receiveddebug1: kex: server->client aes128-ctr hmac-md5 nonedebug1: kex: client->server aes128-ctr hmac-md5 nonedebug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sentdebug1: expecting SSH2_MSG_KEX_DH_GEX_GROUPdebug1: SSH2_MSG_KEX_DH_GEX_INIT sentdebug1: expecting SSH2_MSG_KEX_DH_GEX_REPLYdebug1: Host '10.0.0.17' is known and matches the RSA host key.debug1: Found key in /root/.ssh/known_hosts:2debug1: ssh_rsa_verify: signature correctdebug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug1: SSH2_MSG_NEWKEYS receiveddebug1: SSH2_MSG_SERVICE_REQUEST sentdebug1: SSH2_MSG_SERVICE_ACCEPT receiveddebug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,passworddebug1: Next authentication method: gssapi-keyexdebug1: No valid Key exchange contextdebug1: Next authentication method: gssapi-with-mic | 
上述配置没配就发现卡到gssapi这。就大概知道是gssapi的问题。
实际上在linux系统优化部分就应该优化SSH服务的此处。
linux下SSH远程连接服务慢解决方案的更多相关文章
- Linux下 SSH远程管理服务
		
第1章 SSH基本概述 1.1 SSH服务协议说明 SSH 是 Secure Shell Protocol 的简写,由 IETF 网络工作小组(Network Working Group )制定 在进 ...
 - Linux下SSH远程连接断开后让程序继续运行解决办法
		
一.screen安装 yum install screen #CentOS安装 sudo apt-get install screen #ubuntu安装 二.screen常用命令 screen ...
 - Linux 下 SSH 远程超时解决方案
		
Linux 下 SSH 远程超时解决方案 今天突然看到一个问题说是如何解决SSH远程超时的问题. 找了一点资料.用于解决这个需求~ 第一种:OpenSSH 配置文件设置 位于112行的 "C ...
 - redis在Linux下的远程连接
		
1.redis在Linux下的远程连接: $ redis-cli -h host -p port -a password 如何连接到主机为 127.0.0.1,端口为 6379 ,密码为 mypass ...
 - SSH远程连接服务
		
一.SSH 原理图 二.SSH 原理描述 2.1:什么是SSH SSH是专门为了远程登录会话和其他网络服务提供的安全性协议,使用SSH协议可以有效的防止远程连接会话的时候出现信息泄密,在数据传输的时候 ...
 - linux下ssh远程登录/scp远程复制文件/rsync远程同步命令的自动登录
		
最近需要写一个脚本备份各个服务器上的程序到一个指定服务器上,本来以为查查rsync命令的使用321就能搞定,结果rsync命令要支持自动登 录还是要配置服务和参数,又不确定网上说的配置的行不行,因为都 ...
 - Linux使用SSH远程连接方式和更改密码 ,自己空间转移过来的。
		
一. 远程连接Linux系统需要一个方便的SSH连接工具putty就不错!工具在本日志的附件下载,解压密码是QQ号,云盘访问密码 90891.把远程主机ip和端口号填写上然后选择连接方式为“SSH”. ...
 - 【Linux】ssh远程连接到指定ip的指定用户上
		
通过ssh可以远程连接到其他的机器上,但是如果只想连接到指定的用户的话 需要这样做: -l 选项 (是L不是I,小写) ssh IP -l 用户名 这里的ip如果在hosts下就可以直接输入域名或者主 ...
 - 修改Linux的SSH远程连接端口 技巧
		
将SSH终端服务的端口由 22 修改为别的端口以防攻击黑客直接猜解您的服务器密码 首先修改配置文件 vi /etc/ssh/sshd_config 找到 #Port 22 一段,这里是标识默认使用 2 ...
 
随机推荐
- Js获取Gridview中Dropdownlist选中状态
			
在Gridview中加入Dropdownlist模板列,加入DropDownlist 是一种常用的操作,其中涉及到如何获取选择项和Gridview重新绑定两个要点. 如图 前台代码如下 <%@ ...
 - VS 2003 无法打开Web项目,位于服务器“http:10.45.4.70:8080”上的项目不存在
			
解决方法: 用记事本打开*.sln文件更改第2行 改成正确的虚拟目录 出现这种情况往往是从一台机器搬到另一台机器造成的虚拟路径名字不同
 - WCF入门教程系列一
			
一.概述 Windows Communication Foundation(WCF)是由微软发展的一组数据通信的应用程序开发接口,可以翻译为Windows通讯接口,它是.NET框架的一部分.由 .NE ...
 - QT皮肤框架-TQUI
			
本皮肤框架的相关文档,请在附件中下载,包括测试程序源码,帮助文档.相关文档可到我的百度网盘中下载,或者在本贴附件中下载. 百度网盘地址:TQUI-V1.0项目说明及测试程序源码 项目更新说明:---- ...
 - [Leetcode] Container With Most Water ( C++)
			
题目: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, a ...
 - Mysql 建表时,日期时间类型选择
			
mysql(5.5)所支持的日期时间类型有:DATETIME. TIMESTAMP.DATE.TIME.YEAR. 几种类型比较如下: 日期时间类型 占用空间 日期格式 最小值 最大值 零值表示 D ...
 - POJ1094 拓扑排序
			
问题:POJ1094 本题考查拓扑排序算法 拓扑排序: 1)找到入度为0的点,加入已排序列表末尾: 2)删除该点,更新入度数组. 循环1)2)直到 1. 所有点都被删除,则找到一个拓扑 ...
 - python3.4 伪装成浏览器获取页面信息失败
			
最近学了下网络爬虫,打算从一个网站上提取点东西,自己练练手,刚开始还从这个网站上取了正确的html,后来百般尝试还是不能取正确的html,希望能得到大家的帮助~ 我刚开始的代码是: 1 url=&qu ...
 - USB系列之八:透过ASPI执行SCSI命令
			
在<USB系列之七>里我们介绍了ASPI的规范,并对一系列ASPI的命令做了测试,其中的02号命令是执行SCSI命令,我们专门在这篇文章中介绍,在<USB系列七>中,我们已经了 ...
 - 从Qt4到Qt5的,主要的进化有三(对于QtWidget的精简和优化会很有限)
			
从Qt4到Qt5的,主要的进化有三:1 语言的进化,原来是基于C++(qtwidget)和XML(.ui),现在添加了QML(QtQuick)+JS(v8)的架构.2 绘图系统的进化,原先基于QPai ...