Results 1 to 6 of 6

Thread: SSH Disconnects after a few seconds

  1. #1
    Join Date
    Apr 2015
    Beans
    5

    SSH Disconnects after a few seconds

    Hi,

    I’ve just set up a new Ubuntu 14.04 server and whenever I SSH to it it disconnects me in seconds if inactive.

    I’ve done all the changes below, and still it disconnects me. What have I missed.

    In the /etc/ssh/ssh_config file I have the following
    Code:
    ServerAliveInterval 100
    In the /etc/ssh/sshd_config file I have the following

    Code:
    ClientAliveInterval 600
    TCPKeepAlive yes
    ClientAliveCountMax 10
    In the /etc/default/ssh I have changed the SSHD_OPTS to

    Code:
    SSHD_OPTS='-F /etc/ssh/sshd_config'
    In the ~/.ssh/config file I have the following

    Code:
    Host *
    ServerAliveInterval 100
    What else do I need to change to stop SSH disconnecting me???

    Many thanks in advance.

  2. #2
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,044
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: SSH Disconnects after a few seconds

    First, check /var/log/auth.log for ssh-related errors. Post anything useful. Then comment out your changes and restart ssh or reboot. Also, ssh is a classic client/server application, so you need to look at both the client side and server side. It's possible there is a firewall or router policy that is blocking port 22 and it takes a few seconds to react.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  3. #3
    Join Date
    Apr 2015
    Beans
    5

    Re: SSH Disconnects after a few seconds

    Hi

    Looking at the auth.log sadly didn't give anything away. Results are below

    Code:
    Apr 30 16:50:22 test1 sshd[4179]: Accepted password for testuser from 10.10.10.10 port 43906 ssh2
    Apr 30 16:50:22 test1 sshd[4179]: pam_unix(sshd:session): session opened for user testuser by (uid=0)
    Apr 30 16:51:35 test1 sshd[4179]: pam_unix(sshd:session): session closed for user testuser
    Now the SSH session seems to stop working after only 10sec of no typing. If you keep typing the session stays alive, but with no input or output after 10sec the session stops and a minute later in the auth.log the session is cleared out.

    I've tried with or with my settings in place.
    I've tried multiple VMs (Basic 14.04 setup with no options selected such as database, web, etc. Just a basic vanilla setup)
    I've tried different SSH clients (Putty and also SSH Client from another ubuntu box)

    Still the same results. After 10 seconds it timeouts and you lose the connection.

    As for firewall. I'm running the SSH client on a Windows 8.1 connecting to an Ubuntu VM on the very same box using Bridge Mode. I've turned the Windows firewall off and still does it.

    I don't experience these problems with older ubuntu's using the same SSH client and PC.

    I'm clearly missing a setting somewhere but what????

  4. #4

    Re: SSH Disconnects after a few seconds

    on the pc that logs you out, check for this environment variable:
    Code:
    grep TMOUT .bashrc
    Is anything returned?
    Windows assumes the user is an idiot.
    Linux demands proof.

  5. #5
    Join Date
    Apr 2015
    Beans
    5

    Re: SSH Disconnects after a few seconds

    Hi

    Nope, nothing to returned after the
    Code:
    grep TMOUT .bashrc
    command

    Should there be something?

  6. #6

    Re: SSH Disconnects after a few seconds

    Quote Originally Posted by Ian_Chilvers View Post
    Hi

    Nope, nothing to returned after the
    Code:
    grep TMOUT .bashrc
    command

    Should there be something?
    Not necessarily.
    Windows assumes the user is an idiot.
    Linux demands proof.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •