Skip to content Gå til innhold


How to prevent your SSH session from disconnecting in Linux Hvordan hindre at SSH økt fra frakobling i Linux

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. Alle som har jobbet med en ekstern Linux-server ved hjelp av SSH må ha møtt problemet med å ha SSH økten drop dead når du hodet ut for å få en kopp kaffe. Well, here's a solution to help you configure your SSH daemon on the Linux server to stop it from disconnecting. Vel, her er en løsning for å hjelpe deg med å konfigurere din SSH daemon på Linux serveren for å stoppe den fra frakobling. 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. Hva skjer er at hvis du lar din SSH-tilkobling på og ikke bruke den for en tid SSH server går over i en inaktiv modus og dreper økten. This is really a security measure which can sometimes be a little annoying. Dette er virkelig et sikkerhetstiltak som noen ganger kan være litt irriterende.

To set this up log on to your remote Linux server using SSH. For å sette dette opp logge på den eksterne Linux-server ved hjelp av SSH. Open the SSH configuration file: Åpne SSH konfigurasjonsfilen:

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

Add the following line at the end of the file: Legg til følgende linje på slutten av filen:

ServerAliveInterval 60 ServerAliveInterval 60

Save the file and quit the text editor. Lagre filen og avslutt tekst editor. Now, similarly, open the file ~/.ssh/config . Nå, på samme måte, åpner du filen ~ / .ssh / config. Create the file if it does not already exist. Opprett filen hvis den ikke finnes allerede. Add the following lines: Legg til følgende linjer:

Host * Host *
ServerAliveInterval 60 ServerAliveInterval 60

Note: you need to indent the second line by entering a space at the beginning of the line. Merk: du må rykke inn den andre linjen ved å taste inn et mellomrom i begynnelsen av linjen.

You're all done now. Du er ferdig nå. Time to restart your SSH server. Tid for å starte SSH server. Run the following command: Kjør følgende kommando:

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

This should take a second or two. Dette skal ta et sekund eller to. Then you should be back in business. Da bør du være tilbake i virksomheten. 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. Hva vi har gjort her er at vi har ganske mye lurte SSH-serveren til å tro at SSH-sesjonen er aktiv selv når det ikke. Now you can peacefully take a short coffee break without losing your SSH connection. Nå kan du fredelig ta en kort kaffepause uten å miste SSH forbindelse.

Posted in Posted in Linux Linux . .

Related Posts: Relaterte innlegg:

How to prevent RSI on Windows and Linux with Workrave Hvordan unngå RSI på Windows og Linux med Workrave
How to recursively copy files from an FTP server with Linux Slik rekursivt kopiere filer fra en FTP-server med Linux
How to monitor your Linux machine with netstat Hvordan overvåke din Linux-maskin med netstat
How to SSH from your Windows Mobile Smartphone Slik SSH fra din Windows Mobile Smartphone
How to mount a remote filesystem in Ubuntu Hvordan montere en ekstern filsystem i Ubuntu

0 Responses 0 Responses

Stay in touch with the conversation, subscribe to the Hold kontakten med samtalen, abonnere på RSS feed for comments on this post RSS feed for kommentarer til dette innlegget . .



Some HTML is OK Some HTML is OK

or, reply to this post via eller svare på dette innlegget via trackback styrekule . .