링크 ux 에서 SSH 원 격 연결 서비스 느 린 솔 루 션

전환 하 다http://oldboy.blog.51cto.com/2561410/1300964작자: 올 드 보이
1. 적용 명령 및 방안 은 다음 과 같다. [원 격 연결 및 실행 명령] ssh - p22 [email protected] ssh -p22 [email protected] /sbin / ifconfig [원 격 복사: 푸 시 및 당 김] scp - P22 - r - p / etc [email protected]:/tmp/ scp -P22 -r -p [email protected]:/tmp/ /etc [안전 한 FTP 기능] sftp - oport = 22 [email protected][암호 없 는 검증 방안] 예 를 들 어 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 -n C64 [root @C64   ~] # cat /etc/hosts #modi by oldboy 11:12 2013/9/24 127.0.0.1   C64 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 10.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 [email protected] OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options  for   * debug1: Connecting to 10.0.0.19 [10.0.0.19] port 22. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: identity file /root/.ssh/identity type -1 debug1: identity file /root/.ssh/id_rsa type -1 debug1: identity file /root/.ssh/id_dsa type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3 debug1: match: OpenSSH_4.3 pat OpenSSH_4* debug1: Enabling compatibility mode  for   protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.3 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY The 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 correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Trying private key: /root/.ssh/identity debug1: Trying private key: /root/.ssh/id_rsa debug1: Trying private key: /root/.ssh/id_dsa debug1: Next authentication method: password [email protected]' 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-8 Last login: Tue Sep 24 10:30:02 2013 from 10.0.0.18 [root @C64_A   ~] # ssh -v [email protected] OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options  for   * debug1: Connecting to 10.0.0.17 [10.0.0.17] port 22. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: identity file /root/.ssh/identity type -1 debug1: identity file /root/.ssh/id_rsa type -1 debug1: identity file /root/.ssh/id_dsa type 2 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 debug1: match: OpenSSH_5.3 pat OpenSSH* debug1: Enabling compatibility mode  for   protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.3 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host  '10.0.0.17'   is known and matches the RSA host key. debug1: Found key  in   /root/.ssh/known_hosts:2 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can  continue : publickey,gssapi-keyex,gssapi-with-mic,password debug1: Next authentication method: gssapi-keyex debug1: No valid Key exchange context debug1: Next authentication method: gssapi-with-mic
위 설정 이 어 울 리 지 않 으 면 gs api 에 걸 려 있 습 니 다.대충 gs api 문제 인 줄 알았어 요.실제로 Liux 시스템 최적화 부분 에 서 는 SSH 서 비 스 를 최적화 해 야 한다.

좋은 웹페이지 즐겨찾기