I’m on Mac OSX 10.5 connecting to a Centos 5 box using Terminal. I’m using shared keys and the connection was fine and working well until I left the Terminal window idle for over 15 seconds. I was also finding that SFTP sessions via Transmit would regularly freeze. All of this was very annoying and frustrating.
I discovered that through creating a local config file for ssh you can declare settings that fix this and many other issues. Remember I’m on a Mac OSX 10.5 here. The usual disclaimer applies - this article is unsupported and you make changes at your own risk.
Open terminal and get going:
cd /Users/yourname/.ssh # If you get ""-bash: cd: .ssh: No such file or directory" # You need to create it mkdir /Users/yourname/.ssh # Set security on the folder so only you can read, write and execute chmod 700 /Users/yourname/.ssh # Change directory cd .ssh # Create the config file touch config # Edit the config file vi config # When in vi hit i to enter insert mode and add the following lines to the config file ServerAliveCountMax 3 ServerAliveInterval 10 # Save and quit by hitting :wq # Set correct permissions on the config file chmod 644 /Users/yourname/.ssh/config
Now try connecting via SSH and this should stop your SSH sessions freezing. This instantly fixed the issue for me anyway. Hopefully it might help a few other people.
Through reading the documentation I discovered it is also possible to set configuration on a per user basis for SSH. You can set compression, the port number you are connecting to, specific settings for hostnames and much more.
If you are using SSH on a daily basis having a quick read of the documentation - is likely to throw up a few useful things you can put into a config file.
Have an update or suggestion for this article? You can edit it here and send me a pull request.
Listening to BBC Radio with mpv
The BBC publishes high quality 320 kbps HLS AAC streams that can be used to listen to radio from the command-line using mpv. Here are the URLs and some aliases to start listening quickly.
Vim: So long Pathogen, hello native package loading
Vim 8 added a native way to load third-party packages. This means, for me at least, there is no longer any need to use a third party plugin helper like Pathogen.
Linux and Unix more command tutorial with examples
Tutorial on using more, a UNIX and Linux command for viewing the contents of a file or files one screen at a time. Examples of viewing a file, viewing multiple files, searching using regular expressions and opening the file in a text editor.