AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  ssh connection closed by ip

    Posted Thu April 07, 2011 01:56 AM

    Originally posted by: SystemAdmin


    Hi i am trying to do ssh without password between 2 aix servers.

    before i generate the keys, i am able to do the ssh & it is asking for password & i am able to login.
    ========================
    1. ssh 172.29.150.77
    root@172.29.150.77's password:
    ========================
    but when i generate rsa or dsa keys, i am not able to do ssh
    ========================
    1. ssh-keygen -t rsa
    Generating public/private rsa key pair.

    Enter file in which to save the key (//.ssh/id_rsa): Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in //.ssh/id_rsa.
    Your public key has been saved in //.ssh/id_rsa.pub.
    The key fingerprint is:
    65:22:c8:eb:42:3e:8e:d9:a4:35:b6:77:79:e9:ad:74 root@STARINPRRAC01
    The key's randomart image is:
    -- RSA 2048----
     
    . .
    o . . o
    . . +
    . . S
    o .
    O . ...E
    X =. o.oo
    + +. . oo..

    -----------------
    #
    #
    1. ssh 172.29.150.77
    Connection closed by 172.29.150.77
    ============================

    1. ssh -vvv 172.29.150.77
    OpenSSH_5.2p1, OpenSSL 0.9.8k 25 Mar 2009
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Failed dlopen: /usr/krb5/lib/libkrb5.a(libkrb5.a.so): 0509-022 Cannot load module /usr/krb5/lib/libkrb5.a(libkrb5.a.so).
    0509-026 System error: A file or directory in the path name does not exist.

    debug1: Error loading Kerberos, disabling Kerberos auth.
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to 172.29.150.77 http://172.29.150.77 port 22.
    debug1: Connection established.
    debug1: permanently_set_uid: 0/0
    debug1: identity file /.ssh/identity type -1
    debug3: Not a RSA1 key file /.ssh/id_rsa.
    debug2: key_type_from_name: unknown key type '-----BEGIN'
    debug3: key_read: missing keytype
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug3: key_read: missing whitespace
    debug2: key_type_from_name: unknown key type '-----END'
    debug3: key_read: missing keytype
    debug1: identity file /.ssh/id_rsa type 1
    debug1: identity file /.ssh/id_dsa type -1
    debug1: Remote protocol version 2.0, remote software version OpenSSH_5.2
    debug1: match: OpenSSH_5.2 pat OpenSSH*
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_5.2
    debug2: fd 4 setting O_NONBLOCK
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
    debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
    debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
    debug2: kex_parse_kexinit:
    debug2: kex_parse_kexinit:
    debug2: kex_parse_kexinit: first_kex_follows 0
    debug2: kex_parse_kexinit: reserved 0
    debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
    debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: none,zlib@openssh.com
    debug2: kex_parse_kexinit: none,zlib@openssh.com
    debug2: kex_parse_kexinit:
    debug2: kex_parse_kexinit:
    debug2: kex_parse_kexinit: first_kex_follows 0
    debug2: kex_parse_kexinit: reserved 0
    debug2: mac_setup: found hmac-md5
    debug1: kex: server->client aes128-ctr hmac-md5 none
    debug2: mac_setup: found hmac-md5
    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
    debug2: dh_gen_key: priv key bits set: 126/256
    debug2: bits set: 516/1024
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
    debug3: check_host_in_hostfile: filename /.ssh/known_hosts
    debug3: check_host_in_hostfile: match line 1
    debug1: Host '172.29.150.77' is known and matches the RSA host key.
    debug1: Found key in /.ssh/known_hosts:1
    debug2: bits set: 481/1024
    debug1: ssh_rsa_verify: signature correct
    debug2: kex_derive_keys
    debug2: set_newkeys: mode 1
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug2: set_newkeys: mode 0
    debug1: SSH2_MSG_NEWKEYS received
    debug1: SSH2_MSG_SERVICE_REQUEST sent
    debug2: service_accept: ssh-userauth
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug2: key: /.ssh/identity (0)
    debug2: key: /.ssh/id_rsa (20052258)
    debug2: key: /.ssh/id_dsa (0)
    debug1: Authentications that can continue: publickey,password,keyboard-interactive
    debug3: start over, passed a different list publickey,password,keyboard-interactive
    debug3: preferred 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: /.ssh/identity
    debug3: no such identity: /.ssh/identity
    debug1: Offering public key: /.ssh/id_rsa
    debug3: send_pubkey_test
    debug2: we sent a publickey packet, wait for reply
    Connection closed by 172.29.150.77

    ===============================

    1. cat ssh_config
    2. $OpenBSD: ssh_config,v 1.25 2009/02/17 01:28:32 djm Exp $

    1. This is the ssh client system-wide configuration file. See
    2. ssh_config(5) for more information. This file provides defaults for
    3. users, and the values can be changed in per-user configuration files
    4. or on the command line.

    1. Configuration data is parsed as follows:
    2. 1. command line options
    3. 2. user-specific file
    4. 3. system-wide file
    5. Any configuration value is only changed the first time it is set.
    6. Thus, host-specific definitions should be at the beginning of the
    7. configuration file, and defaults at the end.

    1. Site-wide defaults for some commonly used options. For a comprehensive
    2. list of available options, their meanings and defaults, please see the
    3. ssh_config(5) man page.

    1. Host *
    2. ForwardAgent no
    3. ForwardX11 no
    4. RhostsRSAAuthentication no
    5. RSAAuthentication yes
    6. PasswordAuthentication yes
    7. HostbasedAuthentication no
    8. GSSAPIAuthentication no
    9. GSSAPIDelegateCredentials no
    10. BatchMode no
    11. CheckHostIP yes
    12. AddressFamily any
    13. ConnectTimeout 0
    14. StrictHostKeyChecking ask
    15. IdentityFile ~/.ssh/identity
    16. IdentityFile ~/.ssh/id_rsa
    17. IdentityFile ~/.ssh/id_dsa
    18. Port 22
    19. Protocol 2,1
    20. Cipher 3des
    21. Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
    22. MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
    23. EscapeChar ~
    24. Tunnel no
    25. TunnelDevice any:any
    26. PermitLocalCommand no
    27. VisualHostKey no
    #PreferredAuthentications publickey,hostbased,keyboard-interactive,password

    =========================

    1. cat sshd_config
    2. $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $

    1. This is the sshd server system-wide configuration file. See
    2. sshd_config(5) for more information.

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

    1. The strategy used for options in the default sshd_config shipped with
    2. OpenSSH is to specify options with their default value where
    3. possible, but leave them commented. Uncommented options change a
    4. default value.

    #Port 22
    #AddressFamily any
    #ListenAddress 0.0.0.0
    #ListenAddress ::

    1. Disable legacy (protocol version 1) support in the server for new
    2. installations. In future the default will change to require explicit
    3. activation of protocol 1
    Protocol 2

    1. HostKey for protocol version 1
    #HostKey /etc/ssh/ssh_host_key
    1. HostKeys for protocol version 2
    #HostKey /etc/ssh/ssh_host_rsa_key
    #HostKey /etc/ssh/ssh_host_dsa_key

    1. Lifetime and size of ephemeral version 1 server key
    #KeyRegenerationInterval 1h
    #ServerKeyBits 1024

    1. Logging
    2. obsoletes QuietMode and FascistLogging
    #SyslogFacility AUTH
    #LogLevel INFO

    1. Authentication:

    #LoginGraceTime 2m
    #PermitRootLogin yes
    StrictModes no
    #MaxAuthTries 6
    #MaxSessions 10

    RSAAuthentication no
    #PubkeyAuthentication yes
    #AuthorizedKeysFile .ssh/authorized_keys

    1. For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
    #RhostsRSAAuthentication no
    1. similar for protocol version 2
    #HostbasedAuthentication no
    1. Change to yes if you don't trust ~/.ssh/known_hosts for
    2. RhostsRSAAuthentication and HostbasedAuthentication
    #IgnoreUserKnownHosts no
    1. Don't read the user's ~/.rhosts and ~/.shosts files
    #IgnoreRhosts yes

    1. To disable tunneled clear text passwords, change to no here!
    #PasswordAuthentication yes
    #PermitEmptyPasswords no

    1. Change to no to disable s/key passwords
    #ChallengeResponseAuthentication yes

    1. Kerberos options
    #KerberosAuthentication no
    #KerberosOrLocalPasswd yes
    #KerberosTicketCleanup yes
    #KerberosGetAFSToken no

    1. GSSAPI options
    #GSSAPIAuthentication no
    #GSSAPICleanupCredentials yes

    1. Set this to 'yes' to enable PAM authentication, account processing,
    2. and session processing. If this is enabled, PAM authentication will
    3. be allowed through the ChallengeResponseAuthentication and
    4. PasswordAuthentication. Depending on your PAM configuration,
    5. PAM authentication via ChallengeResponseAuthentication may bypass
    6. the setting of "PermitRootLogin without-password".
    7. If you just want the PAM account and session checks to run without
    8. PAM authentication, then enable this but set PasswordAuthentication
    9. 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 no
    #PidFile /var/run/sshd.pid
    #MaxStartups 10
    #PermitTunnel no
    #ChrootDirectory none

    1. no default banner path
    #Banner none

    1. override default of no subsystems
    Subsystem sftp /usr/libexec/sftp-server

    1. Example of overriding settings on a per-user basis
    #Match User anoncvs
    1. X11Forwarding no
    2. AllowTcpForwarding no
    3. ForceCommand cvs server

    =====================

    1. ls -ld /
    drwxr-xr-x 23 root system 4096 Apr 07 09:54 /
    1. ls -ld /.ssh
    drwx------ 2 root system 256 Apr 07 09:55 /.ssh
    1. ls -ld /.ssh/*
    -rw------- 1 root system 1675 Apr 07 09:55 /.ssh/id_rsa
    -rw-r--r-- 1 root system 400 Apr 07 09:55 /.ssh/id_rsa.pub
    -rw-r--r-- 1 root system 395 Apr 07 09:54 /.ssh/known_hosts


    Post updated at 10:11 AM
    Previous update was at 10:09 AM

    Guys, any help is appreciated.

    for reference i have attached, permissions, ssh_config, sshd_config, verbose output of ssh.

    its been 4 days stuck on same issue.


  • 2.  Re: ssh connection closed by ip

    Posted Sat December 29, 2012 03:59 PM

    Originally posted by: SystemAdmin


    I have a similar problem which i posted in detail on other place

    I opened a software retain call with IBM and no solution yet.

    See here:
    http://www.unix.com/aix/211183-passwordless-ssh-problem-aix-machines.html

    The problem

    if you generate public keys between two LPARs and then SSH you get connection closed

    if you delete everything inside the folder .ssh and then SSH you will get the login/password screen

    If you generate public keys between VIO_SERVER and LPAR == it will work from LPAR TO VIO_SERVER ( ssh vioserver date == YES ) but from vioserver to LPAR it will not work. ==> connection closed

    have been working on this problem now for many days.... tried everything

    anyone any ideas ?


  • 3.  Re: ssh connection closed by ip

    Posted Sat December 29, 2012 08:22 PM

    Originally posted by: SystemAdmin


    Remember to change "PermitRootLogin" to yes in your sshd_config and restart ssh if you are trying to ssh as root.

    Of course, then you are ssh'ing AS root. Technically you should ssh as another user and then su or sudo to root, but you should speak to your security team to make the right decision for your environment.


  • 4.  Re: ssh connection closed by ip

    Posted Sun December 30, 2012 01:19 PM

    Originally posted by: SystemAdmin


    I am not using root for SSH
    i want to use oraprod for SSH ==> for ORACLE purpose

    have tried almost everything.... Don't know what more needs to be done ?


  • 5.  Re: ssh connection closed by ip

    Posted Mon December 31, 2012 02:55 AM

    Originally posted by: SystemAdmin


    seems like alot of people have similar problems but unresolved !

    http://www.ibm.com/developerworks/forums/thread.jspa?threadID=237249&start=15&tstart=0