How to prevent your SSH session from disconnecting in Linux Як запобігти ваш SSH сесію з відключенням в Linux

by Sukrit Dhandhania on April 16, 2009 За Sukrit Dhandhania по 16 квітня 2009

Linux

Anyone who has worked with a remote Linux server using SSH must have faced the problem of having the SSH session drop dead when you head out to get a cup of coffee. Будь-хто, хто працював з віддаленого сервера Linux за допомогою SSH має зіткнулися з проблемою наявності SSH сесії падіння мертвий, коли вам голову, щоб отримати чашку кави. Well, here's a solution to help you configure your SSH daemon on the Linux server to stop it from disconnecting. Ну, от рішення, яке допоможе вам налаштувати SSH демона на сервер Linux, щоб зупинити його з відключенням. What happens is that if you leave your SSH connection on and don't use it for some time the SSH server goes into an idle mode and kills the session. Що відбувається, є те, що якщо ви залишите свої зв'язки з SSH і не використовувати її протягом деякого часу SSH сервер йде в режимі очікування і вбиває сесії. This is really a security measure which can sometimes be a little annoying. Це дійсно захід безпеки, яка може іноді бути трохи дратує.

To set this up log on to your remote Linux server using SSH. Щоб реалізувати цю можливість підключитися до віддаленого серверу Linux за допомогою SSH. Open the SSH configuration file: Відкриття файлу конфігурації SSH:

# vim /etc/ssh/ssh_config # VIM / ETC / SSH / ssh_config

Add the following line at the end of the file: Додайте наступний рядок в кінець файлу:

ServerAliveInterval 60 ServerAliveInterval 60

Save the file and quit the text editor. Збережіть файл і вийдіть з редактора. Now, similarly, open the file ~/.ssh/config . Тепер, аналогічно, відкрийте файл ~ /. Ssh / config. Create the file if it does not already exist. Add the following lines: Додайте наступні рядки:

Host * Хост *
ServerAliveInterval 60 ServerAliveInterval 60

Note: you need to indent the second line by entering a space at the beginning of the line. Примітка: вам потрібно, щоб збільшити відступ другого рядка введення пробілу на початку рядка.

You're all done now. Ви все зробили зараз. Time to restart your SSH server. Час, щоб перезавантажити ваш SSH сервер. Run the following command: Виконайте наступну команду:

# /etc/init.d/sshd restart # / І т.д. / init.d / SSHd перезавантаження

This should take a second or two. Це повинно зайняти одну-дві секунди. Then you should be back in business. Потім ви повинні повернутися в бізнес. What we have done here is that we have pretty much fooled the SSH server into thinking that your SSH session is active even when it's not. Те, що ми зробили тут є те, що ми в значній мірі обдурити SSH сервер, думаючи, що ваш SSH сесія є активним, навіть коли це не так. Now you can peacefully take a short coffee break without losing your SSH connection. Тепер ви могли спокійно зробити коротку перерву кави без втрати SSH з'єднання.

Related Posts: Схожі повідомлення:
  • How to prevent RSI on Windows and Linux with Workrave Як запобігти RSI на Windows і Linux з Workrave
  • How to recursively copy files from an FTP server with Linux Як рекурсивного копіювання файлів з FTP сервера з Linux
  • How to monitor your Linux machine with netstat Як контролювати вашу машину з Linux Netstat
  • How to SSH from your Windows Mobile Smartphone Як SSH з Windows Mobile Smartphone
  • SmallScreenX – simulate screen resolutions in OS X SmallScreenX - модель дозвіл екрану, в OS X
  • Get Simple Help tutorials just like this one in your email inbox every day - for free! Отримати довідки Прості підручників, як це у вашому поштовому ящику щодня - безкоштовно! Just enter your email address below: Просто введіть свою адресу електронної пошти нижче:

    You can always opt out of this email subscription at any time. Ви завжди можете відмовитися від підписки це повідомлення в будь-який час.

    { 0 comments… (0 коментарів ... add one now Додати одну картину } )

    Leave a Comment Залишити коментар

    You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> Ви можете використовувати ці HTML теги і атрибути: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q Cite=""> <strike> <strong>