[user@desktop ~]$ ssh root@foobar...$ sudo su -[YOU HAVE NEW MAIL]root@foobar:/home/root # cd /etc root@foobar:/etc # Connection to 1.2.3.4 closed by remote host.Connection to 1.2.3.4 closed.[user@desktop ~]$ After installing RHEL7 to my desktop (it was RHEL6 before and it worked perfectly). Question: no matter where I ssh, it will always say, connection closed by remote host. a few seconds after login.. Why?? Before fresh install it worked perfectly. UPDATE: 1) What happens if you run telnet yourhost 22. -> I did and telnet didn't closed the connection!UPDATE#2: [USER@DESKTOP applications]$ ssh -vvv USERONSERVER@SERVERNAMEOpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013debug1: Reading configuration data /home/USER/.ssh/configdebug1: /home/USER/.ssh/config line 1: Applying options for dee1*debug1: /home/USER/.ssh/config line 7: Applying options for dee1*debug1: /home/USER/.ssh/config line 18: Applying options for *debug1: Reading configuration data /etc/ssh/ssh_configdebug1: /etc/ssh/ssh_config line 56: Applying options for *debug1: /etc/ssh/ssh_config line 67: Applying options for *debug2: ssh_connect: needpriv 0debug1: Connecting to SERVERNAME [1.2.3.4] port 22.debug1: Connection established.debug3: Incorrect RSA1 identifierdebug3: Could not load /home/USER/.ssh/id_rsa as a RSA1 public keydebug1: identity file /home/USER/.ssh/id_rsa type 1debug1: identity file /home/USER/.ssh/id_rsa-cert type -1debug1: identity file /home/USER/.ssh/id_dsa type -1debug1: identity file /home/USER/.ssh/id_dsa-cert type -1debug1: identity file /home/USER/.ssh/id_ecdsa type -1debug1: identity file /home/USER/.ssh/id_ecdsa-cert type -1debug1: identity file /home/USER/.ssh/id_ed25519 type -1debug1: identity file /home/USER/.ssh/id_ed25519-cert type -1debug1: Enabling compatibility mode for protocol 2.0debug1: Local version string SSH-2.0-OpenSSH_6.6.1debug1: Remote protocol version 1.99, remote software version OpenSSH_6.0debug1: match: OpenSSH_6.0 pat OpenSSH* compat 0x04000000debug2: fd 3 setting O_NONBLOCKdebug3: load_hostkeys: loading entries for host SERVERNAME from file /home/USER/.ssh/known_hostsdebug3: load_hostkeys: found key type RSA in file /home/USER/.ssh/known_hosts:822debug3: load_hostkeys: loaded 1 keysdebug3: order_hostkeyalgs: prefer hostkeyalgs: ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsadebug1: SSH2_MSG_KEXINIT sentdebug1: SSH2_MSG_KEXINIT receiveddebug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1debug2: kex_parse_kexinit: ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-dss-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-dssdebug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.sedebug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.sedebug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96debug2: kex_parse_kexinit: none,zlib@openssh.com,zlibdebug2: kex_parse_kexinit: none,zlib@openssh.com,zlibdebug2: 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: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256debug2: 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.sedebug2: 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.sedebug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96debug2: kex_parse_kexinit: none,zlib@openssh.comdebug2: kex_parse_kexinit: none,zlib@openssh.comdebug2: kex_parse_kexinit: debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: first_kex_follows 0 debug2: kex_parse_kexinit: reserved 0 debug2: mac_setup: setup hmac-md5debug1: kex: server->client aes128-ctr hmac-md5 nonedebug2: mac_setup: setup hmac-md5debug1: kex: client->server aes128-ctr hmac-md5 nonedebug1: kex: ecdh-sha2-nistp256 need=16 dh_need=16debug1: kex: ecdh-sha2-nistp256 need=16 dh_need=16debug1: sending SSH2_MSG_KEX_ECDH_INITdebug1: expecting SSH2_MSG_KEX_ECDH_REPLYdebug1: Server host key: RSA censoreddebug3: load_hostkeys: loading entries for host SERVERNAME from file /home/USER/.ssh/known_hostsdebug3: load_hostkeys: found key type RSA in file /home/USER/.ssh/known_hosts:822debug3: load_hostkeys: loaded 1 keysdebug3: load_hostkeys: loading entries for host 1.2.3.4 from file /home/USER/.ssh/known_hostsdebug3: load_hostkeys: found key type RSA in file /home/USER/.ssh/known_hosts:801debug3: load_hostkeys: loaded 1 keysdebug1: Host 'SERVERNAME' is known and matches the RSA host key.debug1: Found key in /home/USER/.ssh/known_hosts:822debug1: ssh_rsa_verify: signature correctdebug2: kex_derive_keysdebug2: set_newkeys: mode 1debug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug2: set_newkeys: mode 0debug1: SSH2_MSG_NEWKEYS receiveddebug1: SSH2_MSG_SERVICE_REQUEST sentdebug2: service_accept: ssh-userauthdebug1: SSH2_MSG_SERVICE_ACCEPT receiveddebug2: key: /home/USER/.ssh/id_rsa (0x7fe5faa58140),debug2: key: Created by SASGUI (0x7fe5faa589f0),debug2: key: id_rsa (0x7fe5faa59040),debug2: key: /home/USER/.ssh/id_dsa ((nil)),debug2: key: /home/USER/.ssh/id_ecdsa ((nil)),debug2: key: /home/USER/.ssh/id_ed25519 ((nil)),debug1: Authentications that can continue: publickey,password,keyboard-interactivedebug3: start over, passed a different list publickey,password,keyboard-interactivedebug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,passworddebug3: authmethod_lookup publickeydebug3: remaining preferred: keyboard-interactive,passworddebug3: authmethod_is_enabled publickeydebug1: Next authentication method: publickeydebug1: Offering RSA public key: /home/USER/.ssh/id_rsadebug3: send_pubkey_testdebug2: we sent a publickey packet, wait for replydebug1: Server accepts key: pkalg ssh-rsa blen 148debug2: input_userauth_pk_ok: fp censoreddebug3: sign_and_send_pubkey: RSA censoreddebug1: Authentication succeeded (publickey).Authenticated to SERVERNAME ([1.2.3.4]:22).debug1: channel 0: new [client-session]debug3: ssh_session2_open: channel_new: 0debug2: channel 0: send opendebug1: Requesting no-more-sessions@openssh.comdebug1: Entering interactive session.debug1: Remote: Forced command.debug1: Remote: Forced command.debug2: callback startdebug1: Requesting authentication agent forwarding.debug2: channel 0: request auth-agent-req@openssh.com confirm 0debug2: fd 3 setting TCP_NODELAYdebug3: packet_set_tos: set IP_TOS 0x10debug2: client_session2_setup: id 0debug2: channel 0: request pty-req confirm 1debug1: Sending environment.debug3: Ignored env XDG_VTNRdebug3: Ignored env SSH_AGENT_PIDdebug3: Ignored env XDG_SESSION_IDdebug3: Ignored env GUESTFISH_INITdebug3: Ignored env HOSTNAMEdebug3: Ignored env IMSETTINGS_INTEGRATE_DESKTOPdebug3: Ignored env GPG_AGENT_INFOdebug3: Ignored env VTE_VERSIONdebug3: Ignored env TERMdebug3: Ignored env SHELLdebug3: Ignored env XDG_MENU_PREFIXdebug3: Ignored env HISTSIZEdebug3: Ignored env GJS_DEBUG_OUTPUTdebug3: Ignored env WINDOWIDdebug3: Ignored env QTDIRdebug3: Ignored env QTINCdebug3: Ignored env GJS_DEBUG_TOPICSdebug3: Ignored env IMSETTINGS_MODULEdebug3: Ignored env QT_GRAPHICSSYSTEM_CHECKEDdebug3: Ignored env USERdebug3: Ignored env LS_COLORSdebug3: Ignored env SSH_AUTH_SOCKdebug3: Ignored env SESSION_MANAGERdebug3: Ignored env USERNAMEdebug3: Ignored env GNOME_DISABLE_CRASH_DIALOGdebug3: Ignored env GUESTFISH_PS1debug3: Ignored env PATHdebug3: Ignored env MAILdebug3: Ignored env DESKTOP_SESSIONdebug3: Ignored env QT_IM_MODULEdebug3: Ignored env PWDdebug1: Sending env XMODIFIERS = @im=ibusdebug2: channel 0: request env confirm 0debug1: Sending env LANG = en_US.utf8debug2: channel 0: request env confirm 0debug3: Ignored env GDM_LANGdebug3: Ignored env KDEDIRSdebug3: Ignored env GUESTFISH_OUTPUTdebug3: Ignored env PD_SOCKETdebug3: Ignored env GDMSESSIONdebug3: Ignored env HISTCONTROLdebug3: Ignored env XDG_SEATdebug3: Ignored env HOMEdebug3: Ignored env SHLVLdebug3: Ignored env GNOME_DESKTOP_SESSION_IDdebug3: Ignored env XDG_SESSION_DESKTOPdebug3: Ignored env LOGNAMEdebug3: Ignored env QTLIBdebug3: Ignored env DBUS_SESSION_BUS_ADDRESSdebug3: Ignored env LESSOPENdebug3: Ignored env WINDOWPATHdebug3: Ignored env PDHOSTdebug3: Ignored env XDG_RUNTIME_DIRdebug3: Ignored env DISPLAYdebug3: Ignored env QT_PLUGIN_PATHdebug3: Ignored env XDG_CURRENT_DESKTOPdebug3: Ignored env GUESTFISH_RESTOREdebug3: Ignored env XAUTHORITYdebug3: Ignored env OLDPWDdebug3: Ignored env _debug2: channel 0: request shell confirm 1debug2: callback donedebug2: channel 0: open confirm rwindow 0 rmax 32768debug2: channel_input_status_confirm: type 99 id 0debug2: PTY allocation request accepted on channel 0debug2: channel 0: rcvd adjust 2097152debug2: channel_input_status_confirm: type 99 id 0debug2: shell request accepted on channel 0censored - motd here - censored$ sudo su -[YOU HAVE NEW MAIL]root@SERVERNAME:/home/root # dateFri Apr 15 10:39:22 UTC 2016root@SERVERNAME:/home/root # debug1: channel 0: free: client-session, nchannels 1debug3: channel 0: status: The following connections are open:  #0 client-session (t4 r0 i0/0 o0/0 fd 4/5 cc -1)Connection to SERVERNAME closed by remote host.Connection to SERVERNAME closed.Transferred: sent 4240, received 4440 bytes, in 217.5 secondsBytes per second: sent 19.5, received 20.4debug1: Exit status -1[USER@DESKTOP applications]$ 
SSH timeout to everywhere after a fresh RHEL7 install
ssh
The HW was a T450. It turned out the wifi caused the problem. On ethernet cable, it worked perfectly. echo 'options iwlmvm power_scheme=1' >> /etc/modprobe.d/iwlmvm.confcd /bootcp initramfs-3.10.0-327.4.5.el7.x86_64.img initramfs-3.10.0-327.4.5.el7.x86_64.img.origdracut -v -f  initramfs-3.10.0-327.4.5.el7.x86_64.img  3.10.0-327.4.5.el7.x86_64rebooot