解决linux scp、ssh 登陆远程服务器连接速度慢

在使用scp时拷贝文件时建立连接非常慢。其实除了网络原因,还有就是因为在scp拷贝文件前会生成 认证文件。

你可以用 -v 选项确认你的情况. 例如, 下面是 ssh 的详细登陆过程:
cherry@cherry:~$ ssh -v cherry@59.151.47.49
...
...
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
No credentials cache found

debug1: Unspecified GSS failure. Minor code may provide more information
No credentials cache found

debug1: Unspecified GSS failure. Minor code may provide more information


debug1: Next authentication method: publickey
debug1: Trying private key: /home/cherry/.ssh/identity
debug1: Trying private key: /home/cherry/.ssh/id_rsa
debug1: Trying private key: /home/cherry/.ssh/id_dsa
debug1: Next authentication method: password

1. 连接时用命令指定(推荐,理由看注释):

ssh -o GSSAPIAuthentication=no cherry

2. 在 ssh 客户端程序的配置文件里显式禁用 GSSAPI 认证. 如, 编辑 /etc/ssh/ssh_config 文件, 添加或修改使其有如下一行:

GSSAPIAuthentication no

3. 在用户根目录下的 .ssh 目录下创建一个 config 文件. 如, 编辑 /home/cherry/.ssh/config (如果该文件不存在, 则创建之), 添加选项:

GSSAPIAuthentication no

[注] A. /etc/ssh/ssh_config 是全局配置文件, 对其进行的修改会影响所有使用 ssh 客户端的系统用户.
        B. /home/cherry/.ssh/config 是只会影响用户 xcl 的本地 ssh 客户端配置文件. 该文件的所有配置参数会覆盖全局配置文件的相同配置参数.

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值