I have a connection that keep timing out every few minutes
You can make changes on the server and on the client. I preferred to make the changes to the client since the server has more users and may not be not be desirable to make the changes across the board.
- Create a ssh config file in you home .ssh directory e.g /home/whiscard/.ssh/config
$ vim .ssh/config
- Add the server details in the file:
- ServerAliveInterval: number of seconds that the client will wait before sending a null packet to the server (to keep the connection alive).
- ServerAliveCountMax: If the client does not receive a response after five tries (as specified by the ServerAliveCountMax setting), it closes the connection
- The Host value can be any name you want; it is simply a label for the other settings. The Hostname value is the remote host you want to access. Replace username with your own.
- Save the file and make it only read and writeable to your user
$ chmod 600 .ssh/config
- Connect to your account using SSH. To do this, simply type ssh RemoteServer where RemoteServer represents the Host value you specified above.
$ ssh RemoteServer
How to disable SSH timeout
How to keep SSH connections alive
Keep SSH session alive
First you need to generate your ssh key as described in this post.
Then add the public key to your github account in the settings page
Then test whether you can use ssh with your github account from your linux terminal:
imela@curtsey ~ $ ssh -T firstname.lastname@example.org
Warning: Permanently added the RSA host key for IP address '18.104.22.168' to the list of known hosts.
Hi whiscardz! You've successfully authenticated, but GitHub does not provide shell access.
Testing your SSH connection
Specify private SSH-key to use when executing shell command with or without Ruby?
I needed to generate a generic ssh key that I could use on multiple machines as well as on web portals that support ssh keys
Generate a key that was tired to my email account:
$ ssh-keygen -t rsa -b 4096 -C "email@example.com"
Enter a file in which to save the key (/home/you/.ssh/id_rsa): [Press enter]
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
Adding your ssh key to your keyring:
Start the ssh-agent in the background and add your private key to the ssh agent. Incase you used a key with a different name other than id_rsa then edit accordingly:
$ eval "$(ssh-agent -s)"
Agent pid 59566
$ ssh-add ~/.ssh/id_rsa
Generating a new SSH key and adding it to the ssh-agent
How To Set Up SSH Keys
How to generate an SSH key pair in Linux?
Git on the Server – Generating Your SSH Public Key