How to prevent your SSH session from disconnecting in Linux Ako zabrániť váš SSH spojenie z odpojenie v Linuxe

by Sukrit Dhandhania on April 16, 2009 používateľa Sukrit Dhandhania dňa 16. apríla 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. Každý, kto pracuje so vzdialeným serverom Linuxu cez SSH musel čeliť problému s SSH chcípnutí, keď hlavu von, aby si šálku kávy. Well, here's a solution to help you configure your SSH daemon on the Linux server to stop it from disconnecting. No, tu je riešenie, ktoré vám pomôžu konfigurovať SSH démona na serveri Linux zastaviť od odpojenie. 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. Čo sa stane, je, že ak opustíte svoju SSH pripojenia a nepoužívajte ho po nejakú dobu SSH server prejde do režimu voľnobehu, a zabije zasadnutí. This is really a security measure which can sometimes be a little annoying. To je naozaj bezpečnostné opatrenie, ktoré môže byť niekedy trochu nepríjemné.

To set this up log on to your remote Linux server using SSH. Nastavenie vykonať prihlásení k vzdialenému serveru Linuxu cez SSH. Open the SSH configuration file: Otvorte konfiguráciu SSH file:

# vim /etc/ssh/ssh_config # Vim / etc / ssh / ssh_config

Add the following line at the end of the file: Pridajte nasledujúci riadok na koniec súboru:

ServerAliveInterval 60 ServerAliveInterval 60

Save the file and quit the text editor. Uložte súbor a ukončite textový editor. Now, similarly, open the file ~/.ssh/config . A teraz, podobne, Otvoriť súbor ~ /. Ssh / config. Create the file if it does not already exist. Vytvorte súbor, ak ešte neexistuje. Add the following lines: Pridajte nasledujúce riadky:

Host * Host *
ServerAliveInterval 60 ServerAliveInterval 60

Note: you need to indent the second line by entering a space at the beginning of the line. Poznámka: musíte zarážky druhého riadku zadaním miesto na začiatku riadku.

You're all done now. Ste všetci hotovo. Time to restart your SSH server. Čas reštartovať SSH server. Run the following command: Zadajte nasledujúci príkaz:

# /etc/init.d/sshd restart # / Etc / init.d / sshd restart

This should take a second or two. To by malo trvať sekundu alebo dve. Then you should be back in business. Potom by ste mali byť späť v hre. 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. To, čo sme urobili je, že máme docela hodně zmiasť SSH server, aby si mysleli, že vaša SSH je aktívna, aj keď to nie je. Now you can peacefully take a short coffee break without losing your SSH connection. Teraz si môžete pokojne vziať krátke prestávky na kávu, bez toho aby ste stratili SSH spojenie.

Related Posts: Súvisiace zmeny:
  • How to prevent RSI on Windows and Linux with Workrave Ako sa brániť RSI pre Windows a Linux s Workrave
  • How to recursively copy files from an FTP server with Linux Ako sa rekurzívne kopírovanie súborov z FTP servera s Linuxom
  • How to monitor your Linux machine with netstat Ako sledovať váš počítač s Linuxom netstat
  • How to SSH from your Windows Mobile Smartphone Ako na SSH z vašich Windows Mobile Smartphone
  • SmallScreenX – simulate screen resolutions in OS X SmallScreenX - simulovať rozlíšenie obrazovky v OS X
  • Get Simple Help tutorials just like this one in your email inbox every day - for free! Get Help jednoduchá cvičenie, rovnako ako to vo vašej e-mailovej schránky každý deň - zadarmo! Just enter your email address below: Stačí zadať e-mailovú adresu:

    You can always opt out of this email subscription at any time. Vždy sa môžete odhlásiť z tohto e-mailu predplatného kedykoľvek.

    { 0 comments… (0 comments ... add one now pridať jednu teraz } )

    Leave a Comment Zanechať komentár

    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> Môžete použiť tieto HTML tagy a atribúty: href = "" <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> del datetime <em> <i> <q Cite=""> <strike> <strong>