无法连接到 IBMi sshd 服务器,密码认证

问题描述

我正在尝试访问 IBMi 上的 SSHD 服务器。但是我一直收到 Permission denied (publickey,password,keyboard-interactive).

我在 IBMi 上运行 v7r2

这一直有效,直到运行命令将 yum 安装在分区上。 (Yum 命令有效,至少在 qp2term 中是这样。) 遵循以下说明:[https://ibmi-oss-docs.readthedocs.io/en/latest/yum/README.html][1]

在运行 ssh test400 命令的 5250 调用 qp2term 会话中,使用相同的用户登录时遇到相同的错误\调试

我是 Unix 或 Linux 的新手,请帮忙。

我采取的步骤(我之前也使用过公钥认证)

  • ENDTcpsVR SERVER(*SSHD)STRTcpsVR SERVER(*SSHD)(多次且在每次 SSHD_config 更改之后。)
  • CHGUSRPRF USRPRF(user) HOMEDIR('/home/user')
  • 验证服务器是否正在运行 [i Network 导航 -> 服务器 -> TCP/IP 服务器 -> SSHD][2]
  • chown user /home/user
  • chmod 0700 /home/user

结果drwx------ 6 user 0 45056 Mar 29 22:02 user

  • chmod 0700 /home/user/.ssh

结果drwx------ 2 user 0 8192 Mar 29 20:51 user/.ssh

配置位于 CL 中并使用 CL 进行编辑 EDTF STMF('/QOpenSys/QIBM/UserData/SC1/OpenSSH/etc/sshd_config')

SSHD_CONfig

# $OpenBSD: sshd_config,v 1.75 2007/03/19 01:01:29 djm Exp $                                                            
                                                                                                                        
# This is the sshd server system-wide configuration file.  See                                                          
# sshd_config(5) for more information.                                                                                  
                                                                                                                        
# This sshd was compiled with PATH=/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin            
                                                                                                                        
# 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 /QOpenSys/QIBM/ProdData/SC1/OpenSSH/etc/ssh_host_key           
# HostKeys for protocol version 2                                       
#HostKey /QOpenSys/QIBM/ProdData/SC1/OpenSSH/etc/ssh_host_rsa_key       
#HostKey /QOpenSys/QIBM/ProdData/SC1/OpenSSH/etc/ssh_host_dsa_key  
                                                                          
# Lifetime and size of ephemeral version 1 server key                     
#KeyRegenerationInterval 1h                                               
#ServerKeyBits 768                                                        
                                                                          
# Logging                                                                 
# obsoletes QuietMode and FascistLogging                                  
#SyslogFacility AUTH                                                      
#LogLevel INFO                                                            
#LogLevel INFO                                    
                                                  
# Authentication:                                 
                                                  
#LoginGraceTime 2m                                
#PermitRootLogin yes                              
#StrictModes yes                                  
#MaxAuthTries 6                                   
                                                  
#RSAAuthentication yes                            
#PubkeyAuthentication yes                         
#AuthorizedKeysFile .ssh/authorized_keys          

# For this to work you will also need host keys in /QOpenSys/QIBM/ProdData/SC1/OpenSSH/etc/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 yes                                                
                                                                          
# Change to no to disable s/key passwords                                 
# ChallengeResponseAuthentication no                                      
                                                                          
# Kerberos options                                                        
#KerberosAuthentication 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                                                                    
                                                                               
#AllowTcpForwarding yes   
#GatewayPorts no                       
#X11Forwarding no                      
#X11displayOffset 10                   
#X11UseLocalhost yes                   
#PrintMotd yes                         
#PrintLastLog yes                      
#TCPKeepAlive yes                      
#UseLogin no                           
UsePrivilegeSeparation no              
#PermitUserEnvironment no 
#Compression delayed         
#ClientAliveInterval 0       
#ClientAliveCountMax 3       
#UsednS yes                  
#PidFile /var/tmp/sshd.pid   
#MaxStartups 10              
#PermitTunnel no             
#Allow Users user          
                             
# no default banner path      
#Banner /some/path                                                                 
                                                                                   
# override default of no subsystems                                                
#Subsystem sftp /QOpenSys/QIBM/ProdData/SC1/OpenSSH/libexec/sftp-server            
                                                                                   
# Example of overriding settings on a per-user basis                               
#Match User anoncvs                                                                
# X11Forwarding no                                                                 
# AllowTcpForwarding no                                                            
# ForceCommand cvs server       

                                                                                                                                
                                                                                                                                
#For IBM i older than 7.4: If your user profile is more than 8 characters long,you will need to edit #sshd_config. In that case,add this line:
ibmpaseforienv PASE_USRGRP_LIMITED=N                                                                                                                                                                                                                                                                                                                                                                                                                                    

SSH_CONfig

# $OpenBSD: ssh_config,v 1.23 2007/06/08 04:40:40 pvalchev Exp $                       
                                                                                       
# This is the ssh client system-wide configuration file.  See                          
# ssh_config(5) for more information.  This file provides defaults for                 
# users,and the values can be changed in per-user configuration files                 
# or on the command line.                                                              
                                                                                       
# Configuration data is parsed as follows:                                             
#  1. command line options                                                             
#  2. user-specific file                                                               
#  3. system-wide file                                                                 
# Any configuration value is only changed the first time it is set.                    
# Thus,host-specific deFinitions should be at the beginning of the                    
# configuration file,and defaults at the end.                                         
                                                                                       
# Site-wide defaults for some commonly used options.  For a comprehensive              
# list of available options,their meanings and defaults,please see the    
# ssh_config(5) man page.                                                         
                                                                                  
# Host *                                                                          
#   ForwardAgent no                                                               
#   ForwardX11 no                                                                 
#   RhostsRSAAuthentication no                                                    
#   RSAAuthentication yes                                                         
#   PasswordAuthentication yes                                                    
#   HostbasedAuthentication no                                                    
#   GSSAPIAuthentication no   
#   GSSAPIDelegateCredentials no        
#   BatchMode no                        
#   CheckHostIP yes                     
#   AddressFamily any                   
#   ConnectTimeout 0                    
#   StrictHostKeyChecking ask           
#   IdentityFile ~/.ssh/identity        
#   IdentityFile ~/.ssh/id_rsa          
#   IdentityFile ~/.ssh/id_dsa          
#   Port 22        
#   Protocol 2,1                                                                        
#   Cipher 3des                                                                         
#   Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc  
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160                          
#   EscapeChar ~                                                                        
#   Tunnel no                                                                           
#   TunnelDevice any:any                                                                
#   PermitLocalCommand no                                                                                                                                                  

SSH 尝试使用 -vvv

cuser@Cuser:~$ ssh user@test400 -vvv
OpenSSH_8.2p1 Ubuntu-4ubuntu0.1,OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "test400" port 22
debug2: ssh_connect_direct
debug1: Connecting to test400 [192.168.100.10] port 22.
debug1: Connection established.
debug1: identity file /home/cuser/.ssh/id_rsa type -1
debug1: identity file /home/cuser/.ssh/id_rsa-cert type -1
debug1: identity file /home/cuser/.ssh/id_dsa type -1
debug1: identity file /home/cuser/.ssh/id_dsa-cert type -1
debug1: identity file /home/cuser/.ssh/id_ecdsa type -1
debug1: identity file /home/cuser/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/cuser/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/cuser/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/cuser/.ssh/id_ed25519 type -1
debug1: identity file /home/cuser/.ssh/id_ed25519-cert type -1
debug1: identity file /home/cuser/.ssh/id_ed25519_sk type -1
debug1: identity file /home/cuser/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/cuser/.ssh/id_xmss type -1
debug1: identity file /home/cuser/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
debug1: Remote protocol version 2.0,remote software version OpenSSH_8.0
debug1: match: OpenSSH_8.0 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to test400:22 as 'user'
debug3: hostkeys_foreach: reading file "/home/cuser/.ssh/kNown_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/cuser/.ssh/kNown_hosts:1
debug3: load_hostkeys: loaded 1 keys from test400
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,ssh-ed25519,sk-ssh-ed25519@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: rsa-sha2-512,ssh-rsa,ssh-ed25519
debug2: ciphers ctos: chacha20-poly1305@openssh.com,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:7/Lsut8OAUNQYXvPW6gzSM1ldRsRLcLJbIKw6/UBIPU
debug3: hostkeys_foreach: reading file "/home/cuser/.ssh/kNown_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/cuser/.ssh/kNown_hosts:1
debug3: load_hostkeys: loaded 1 keys from test400
debug3: hostkeys_foreach: reading file "/home/cuser/.ssh/kNown_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/cuser/.ssh/kNown_hosts:2
debug3: load_hostkeys: loaded 1 keys from 192.168.100.10
debug1: Host 'test400' is kNown and matches the ECDSA host key.
debug1: Found key in /home/cuser/.ssh/kNown_hosts:1
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/cuser/.ssh/id_rsa
debug1: Will attempt key: /home/cuser/.ssh/id_dsa
debug1: Will attempt key: /home/cuser/.ssh/id_ecdsa
debug1: Will attempt key: /home/cuser/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/cuser/.ssh/id_ed25519
debug1: Will attempt key: /home/cuser/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/cuser/.ssh/id_xmss
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-dss,ecdsa-sha2-nistp521>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,keyboard-interactive
debug3: start over,passed a different list publickey,keyboard-interactive
debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/cuser/.ssh/id_rsa
debug3: no such identity: /home/cuser/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /home/cuser/.ssh/id_dsa
debug3: no such identity: /home/cuser/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/cuser/.ssh/id_ecdsa
debug3: no such identity: /home/cuser/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/cuser/.ssh/id_ecdsa_sk
debug3: no such identity: /home/cuser/.ssh/id_ecdsa_sk: No such file or directory
debug1: Trying private key: /home/cuser/.ssh/id_ed25519
debug3: no such identity: /home/cuser/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /home/cuser/.ssh/id_ed25519_sk
debug3: no such identity: /home/cuser/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /home/cuser/.ssh/id_xmss
debug3: no such identity: /home/cuser/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet,disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet,wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet,disable method
debug3: authmethod_lookup password
debug3: remaining preferred:
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
user@test400's password:
debug3: send packet: type 50
debug2: we sent a password packet,keyboard-interactive
Permission denied,please try again.
user@test400's password:
debug3: send packet: type 50
debug2: we sent a password packet,keyboard-interactive
debug2: we did not send a packet,disable method
debug1: No more authentication methods to try.
user@test400: Permission denied (publickey,keyboard-interactive).

解决方法

显然它必须有几个外壳之一。 https://www.ibm.com/support/pages/qsys2setpaseshellinfo

如何设置用户shell

Set default PASE IBM i shell for individual user