Subscribe to How-To Geek Підписатись на How-To Geek

Important! This is an automatic machine translated page. If you can read english, you should Click Here to read the original English version of the article.

Keep Your Linux SSH Session From Disconnecting Зберігайте Ваш Linux SSH сесію від'єднання

I'm the type of geek that has an SSH client open at all times, connected to my most frequently used servers so that I have instant access for monitoring and anything else. Я тип комп'ютерів, який SSH клієнт відкриті у всі часи, пов'язані з моїм найбільш часто використовуваних серверів таким чином, що я миттєвий доступ для спостереження і багато чого іншого. As such, it irritates me greatly when I get disconnected, so I'm sharing a few methods for keeping your session alive. Як така, вона мене дуже дратує, коли я отримаю відключений, так що я ділю кілька методів для підтримки своєї сесії в живих.

You can configure the ssh client to automatically send a protocol no-op code code every number of seconds so that the server won't disconnect you. Ви можете налаштувати SSH клієнт для автоматичної відправки протокол № ОП-код Код кожні кількість секунд, так що сервер не буде відключати вас. This is setting is sometimes referred to as Keep-Alive or Stop-Disconnecting-So-Much in other clients. Це налаштування іноді називають Keep-Alive і Stop-Відключення-So-багато інших клієнтів.

Global Configuration Global Configuration

Add the following line to the /etc/ssh/ssh_config file: Додайте наступний рядок у файл / ETC / SSH / ssh_config файлу:

ServerAliveInterval 60 ServerAliveInterval 60

The number is the amount of seconds before the server with send the no-op code. Число це кількість секунд, перш ніж відправити серверу не оп-кодом.

Current User Configuration Поточні Конфігурація користувача

Add the following lines to the ~/.ssh/config file (create if it doesn't exist) Додайте наступні рядки в ~ /. Ssh / файл конфігурації (створити, якщо він не існує)

Host * Хост *
ServerAliveInterval 60 ServerAliveInterval 60

Make sure you indent the second line with a space. Переконайтеся, що ви абзаці другому відповідно до простором.

Per-Host Configuration Пер-Host Configuration

If you only want to enable keep alive for a single server, you can add that into the ~/.ssh/config file with the following syntax: Якщо ви тільки хочете, щоб зберегти живими на одному сервері, можна додати його в каталог ~ /. Ssh / конфігураційний файл з наступним синтаксисом:

Host *hostname.com Хост * hostname.com
ServerAliveInterval 60 ServerAliveInterval 60

Works quite well, hope it helps somebody else out there. Працює досить добре, сподіваємося, що вона допомагає хтось інший там.

This article was originally written on 08/16/07 Tagged with: Ця стаття була спочатку написана на 08/16/07 тегами: Linux Linux

Daily Email Updates Email Щоденні оновлення

You can get our how-to articles in your inbox each day for free. Ви можете отримати наші довідкові статті у Вашу поштову скриньку щодня безкоштовно. Just enter your name and email below: Просто введіть ваші ім'я та адресу електронної пошти нижче:


Name: Ім'я:
Email: Електронна пошта:

Comments (8) Комментарии (8)

  1. Micha Миха

    Thanks a lot! Спасибо большое!

    That'll save my life! Це буде врятувати моє життя!
    OK, I wouldn't die if i didn't know this, but it shuold make life easier. ОК, я б не померти, якщо я не знаю, але це shuold зробити життя легше. I hate being disconnected… Я ненавиджу, коли відключений ...

  2. Chuck Чак

    That's a great tip. Це великі чайові. Another idea (one you can use in tandem with the above) is to use the “screen” program. Ще одна ідея (яку ви можете використовувати в поєднанні з вище) полягає у використанні "Екран" програми. Then, if you are somehow disconnected you can just re-atach the screen and all your stuff is there just as you left it. Потім, якщо ви якось відключені ви можете просто повторно atach екрані, і всі ваші речі є так само, як ви його залишили.

  3. Dan Dan

    Already knew this, but it popped up on my iGoogle page as I have your feed on there, great tip and excellent explination, KISS Вже знав це, але він вискочив на моїй сторінці iGoogle, як я ваш канал там, великий кінчик і відмінні explination, KISS : D (Keep it simple Stupid) (Keep It простих дурних)

    I'll be pointing some of my customers to this blog entry Я буду вказувати Деякі з моїх клієнтів на цей запис у блозі : P

  4. oOJINxOo oOJINxOo

    ty soooo much ^_^ Ти багато чого Soooo ^ _ ^

  5. Nathan Натан

    Helped much, thanks mate! Допомагав багато чого, завдяки мат!

  6. Ammar Аммар

    thnx Thnx :)

  7. Chris Кріс

    So I have an account to a linux machine @ school that I do most of my programming projects through. Так що я увагу на Linux машині @ школу, що я сам з моїх проектів в рамках програмування. I ssh into my account and work from there and many a times my session times out while reading a how-to article and I have to reconnect( annoying ). Я SSH в свій акаунт і працювати звідти, і багато разів мої сесії часу очікування при читанні інструкцій до статті, і я повинен відновити (дратує). The thing is security on my schools system is really tight. Справа в безпеці в моїй системі шкіл дійсно жорсткою. /what I want to know is will I be able to run this command as joe user or do I need root permission to do it? / Що я хочу знати, я зможу запустити цю команду як Джо користувачів або мені потрібен дозвіл корінних це зробити? I can edit some things like my bash profile but I cannot add programs with apt or change any system files….. Я можу відредагувати деякі речі, як моя Bash профілю, але я не можу додати програми з APT або змінити будь-які системні файли ... .. It seems like the session time is something regulated by the systems admins but idk……… thanks for your help. Здається, що час сесії щось регулюється за допомогою систем, але адміністратори ИДК ... ... ... Дякуємо за вашу допомогу. I love this blog! Я люблю цей блог!

  8. linux lover Linux коханець

    Thanks for this tips. Дякуємо вам за це поради.
    It help me much today, working on SSH connection. Це допомагає мені багато чого сьогодні, працюючи на SSH з'єднання.


Our Friends Наші друзі
Getting Started Приступаючи до роботи


About How-To Geek Про How-To Geek
What Is That Process? Що це за процес?
svchost.exe svchost.exe
jusched.exe jusched.exe
dwm.exe dwm.exe
ctfmon.exe Ctfmon.exe
wmpnetwk.exe wmpnetwk.exe
wmpnscfg.exe wmpnscfg.exe
rundll32.exe rundll32.exe
wfcrun32.exe wfcrun32.exe
Ipoint.exe Ipoint.exe
Itype.exe Itype.exe
Wfica32.exe Wfica32.exe
Mobsync.exe Mobsync.exe
conhost.exe conhost.exe
Dpupdchk.exe Dpupdchk.exe Adobe_Updater.exe Adobe_Updater.exe

Copyright © 2006-2009 HowToGeek.com. Copyright © 2006-2009 HowToGeek.com. All Rights Reserved. Всі права захищені.