吃饭的时候吃饭,睡觉的时候睡觉,工作的时候工作,学习的时候学习......
❝ SSH无法登录AIX6.1的常见原因及解决办法 ❞
作者:彭新 日期:2014-04-01 分类:AIX 点击: 来源:www.wo81.com

转载声明:本站文章若无特别说明,皆为原创,转载请注明来源,谢谢 !

迄今为止,我碰到的原因有如下6种:

1、sshd子系统没启动

客户端登录时报错:The remote system refused the connection.
如果是操作系统刚刚重启,那么稍等一下,等它启动完成。否则,请检查它是否启动。

如何检查是否启动?

已启动:
# lssrc -s sshd
Subsystem         Group            PID          Status 
 sshd             ssh              208930       active
未启动:
# lssrc -s sshd   
Subsystem         Group            PID          Status 
 sshd             ssh                           inoperative
对于服务未启动这种问题,我们只要启动sshd子系统即可解决问题。

如何启动sshd子系统?

# startsrc -s sshd
0513-059 The sshd Subsystem has been started. Subsystem PID is 553084.
启动后检查,发现sshd已经启动,如下所示:
# lssrc -s sshd
Subsystem         Group            PID          Status 
 sshd             ssh               553084      active

2、没有安装openssh

客户端登录时报错:The remote system refused the connection.

怎么知道是否安装了openssh?

方法一:lslpp

# lslpp -l|grep ssh
  openssh.base.client     5.2.0.5300  COMMITTED  Open Secure Shell Commands
  openssh.base.server     5.2.0.5300  COMMITTED  Open Secure Shell Server
  openssh.man.en_US       5.2.0.5300  COMMITTED  Open Secure Shell
  openssh.msg.en_US       5.2.0.5300  COMMITTED  Open Secure Shell Messages -
  openssh.base.client     5.2.0.5300  COMMITTED  Open Secure Shell Commands
  openssh.base.server     5.2.0.5300  COMMITTED  Open Secure Shell Server

如果没有看到类似如上的结果,说明没有安装。

方法二: lssrc

# lssrc -s sshd

如果没有任何结果,一般也说明没安装。

方法三:smitty list

smitty list  →
 List Installed Software and Related Information  →
 List Installed Software  →
* SOFTWARE name                                      [all]   
使用 /ssh在结果中找!
安装方法请参考:AIX6.1光盘安装openssh

3、端口配置错误

客户端登录时报错: The remote system refused the connection.

查看当前端口?

# cat /etc/ssh/sshd_config

找到Port开头的行,如果前面有注释(#Port),说明使用默认端口22,否则就是使用了Port后面那个数字端口。

4、修改了openssh端口,但没有重启服务

客户端登录时报错:The remote system refused the connection.
这种问题一般是修改了端口后(/etc/ssh/sshd_config中的Port行),没有重启openssh服务,重启方法:
# stopsrc -s sshd

# startsrc -s sshd

5、修改了openssh端口,但是端口冲突了

症状:客户端登录时没有反应。
我曾经将/etc/ssh/sshd_config中的 #Port 22 改成了 Port 25 做过测试,确实客户端没有反应了,后来改成 Port 29 就可以连接上了。

6、协议不匹配

客户端登录时报错: The client has disconnected from the server.  Reason:Protocol version mismatch. Required protocol version is 1.3 - 1.99.  Received version was 2.0. 
这是因为客户端登录时选择了ssh1协议,aix6.1安装openssh后默认使用2.0协议,需要客户端登录的协议改成ssh2即可登录。

相关资料

1、查看ssh进程

# ps -ef | grep sshd
    root 430148 159844   0 02:26:48      -  0:00 /usr/sbin/sshd

2、重启sshd服务

# stopsrc -s sshd
0513-044 The /usr/sbin/sshd Subsystem was requested to stop.
# startsrc -s sshd
0513-059 The sshd Subsystem has been started. Subsystem PID is 241868.

3、/etc/ssh/sshd_config配置文件示例

# cat /etc/ssh/sshd_config

#       $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $

 

# This is the sshd server system-wide configuration file.  See

# sshd_config(5) for more information.

 

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

 

# The strategy used for options in the default sshd_config shipped with

# OpenSSH is to specify options with their default value where

# possible, but leave them commented.  Uncommented options change a

# default value.

 

#Port 22

#AddressFamily any

#ListenAddress 0.0.0.0

#ListenAddress ::

 

# Disable legacy (protocol version 1) support in the server for new

# installations. In future the default will change to require explicit

# activation of protocol 1

Protocol 2

 

# HostKey for protocol version 1

#HostKey /etc/ssh/ssh_host_key

# HostKeys for protocol version 2

#HostKey /etc/ssh/ssh_host_rsa_key

#HostKey /etc/ssh/ssh_host_dsa_key

 

# Lifetime and size of ephemeral version 1 server key

#KeyRegenerationInterval 1h

#ServerKeyBits 1024

 

# Logging

# obsoletes QuietMode and FascistLogging

#SyslogFacility AUTH

#LogLevel INFO

 

# Authentication:

 

#LoginGraceTime 2m

#PermitRootLogin yes

#StrictModes yes

#MaxAuthTries 6

#MaxSessions 10

 

#RSAAuthentication yes

#PubkeyAuthentication yes

#AuthorizedKeysFile     .ssh/authorized_keys

 

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts

#RhostsRSAAuthentication no

# similar for protocol version 2

#HostbasedAuthentication no

# Change to yes if you don't trust ~/.ssh/known_hosts for

# RhostsRSAAuthentication and HostbasedAuthentication

#IgnoreUserKnownHosts no

# Don't read the user's ~/.rhosts and ~/.shosts files

#IgnoreRhosts yes

 

# To disable tunneled clear text passwords, change to no here!

#PasswordAuthentication yes

#PermitEmptyPasswords no

 

# Change to no to disable s/key passwords

#ChallengeResponseAuthentication yes

 

# Kerberos options

#KerberosAuthentication no

#KerberosOrLocalPasswd yes

#KerberosTicketCleanup yes

#KerberosGetAFSToken no

 

# GSSAPI options

#GSSAPIAuthentication no

#GSSAPICleanupCredentials yes

 

# Set this to 'yes' to enable PAM authentication, account processing, 

# and session processing. If this is enabled, PAM authentication will 

# be allowed through the ChallengeResponseAuthentication and

# PasswordAuthentication.  Depending on your PAM configuration,

# PAM authentication via ChallengeResponseAuthentication may bypass

# the setting of "PermitRootLogin without-password".

# If you just want the PAM account and session checks to run without

# PAM authentication, then enable this but set PasswordAuthentication

# and ChallengeResponseAuthentication to 'no'.

#UsePAM no

 

#AllowAgentForwarding yes

#AllowTcpForwarding yes

#GatewayPorts no

#X11Forwarding no

#X11DisplayOffset 10

#X11UseLocalhost yes

#PrintMotd yes

#PrintLastLog yes

#TCPKeepAlive yes

#UseLogin no

#UsePrivilegeSeparation yes

#PermitUserEnvironment no

#Compression delayed

#ClientAliveInterval 0

#ClientAliveCountMax 3

#UseDNS yes

#PidFile /var/run/sshd.pid

#MaxStartups 10

#PermitTunnel no

#ChrootDirectory none

 

# no default banner path

#Banner none

 

# override default of no subsystems

Subsystem       sftp    /usr/libexec/sftp-server

 

# Example of overriding settings on a per-user basis

#Match User anoncvs

#       X11Forwarding no

#       AllowTcpForwarding no

#       ForceCommand cvs server

 

本文链接:SSH无法登录AIX6.1的常见原因及解决办法

转载声明:本站文章若无特别说明,皆为原创,转载请注明来源,谢谢 !