Archive for the ‘SSH’ Category

Prevent your SSH connection from locking up

Have you ever been working on a Terminal shell SSH session, get busy and then went back to the shell to issue some more commands or look at something only to find that the shell window has locked up.

This requires you to close the Terminal window, open a new one and then login to your remote session again.

In a previous post here, I showed you how to create a ~/.ssh/config file.

Simply add these two lines to your ~/.ssh/config file and any SSH connection that you have to a remove server should not lock up.

ServerAliveCountMax 3
ServerAliveInterval 10

Simplifying SSH command to access Amazon EC2 server

If you are like me and you have to push the up arrow in your terminal window each time you need to remember exactly what the command is to access your Amazon EC2 server, here is a time saving SSH configuration trick for you.


$ cd ~/.ec2
$ ssh -i davidskey.pem

You can create a config file in your ~/.ssh directory to include your identity file for individual host names.
If your Amazon server has a public DNS entry which points to the long Amazon public DNS name, you can make this even easier.

$ cd ~/.ssh
$ ls -al (if you don't find a file called "config" you can create one using the following line)
$ touch config
$ nano config

Add these lines: (assuming that is a CNAME DNS entry which points to

IdentityFile ~/.ec2/davidskey.pem

Host IdentityFile ~/.ec2/davidskey.pem

Now you can SSH to both domain names using only the following. Also note that you do not have to change to the ~/.ec2/ directory to issue the SSH command anymore.

$ ssh
$ ssh

One final note, is that this would work on any host that you use a keyfile to access via SSH. This is of course, not limited to Amazon EC2 server access.


I'm currently available
for Lotus Notes / Domino consulting engagements.


Connect with me: