Using an SSH Config File

  • Applies to: All Service Types
    • Difficulty: Hard
    • Time Needed: 10
    • Tools Required: SSH, vi knowledge


By creating a local configuration file for SSH, you can create shortcuts for servers you frequently access, in addition to configuring more advanced options. This article will demonstrate how to create a shortcut to your VPS server, including how to keep your connection active.


This article has the following dependencies:

  • Please make sure you have a basic understanding of SSH and have configured access for the root user or a domain user. See Connecting via SSH to your server for assistance.
  • is used as an example. Please be sure to replace this text with the proper information for your site or server.
  • This article assumes that you are using a Unix operating system, such as Mac OS X or Ubuntu. We will use OS X as our example. Please modify as needed for your environment.

This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by (mt) Media Temple. Please take a moment to review the Statement of Support.


1. Launch the terminal application on your local computer and create your config file in your home directory:

On OS X, this is located at /Applications/Utilities/ Consider dragging this application into your Dock for convenience.

touch /Users/username/.ssh/config

Your .ssh directory is automatically created when you use the ssh command for the first time. If you have never used ssh before under this user account please create the directory first using:

mkdir /Users/username/.ssh && chmod 700 /Users/username/.ssh

2. Edit the file using vi or any Unix text editor you are comfortable with. We will use vi:

vi /Users/username/.ssh/config

3. There are many options for your config file. Below is an example entry for a shortcut to your VPS server:

Host VPS

User domainuser

4. Now that you have your shortcut created, you can add even more options directly below these entries. For instance, maybe you want to make sure your session "stays alive" while you step away from your keyboard for a bit. The following example will refresh your connection every 30 seconds for a maximum of one hour:

ServerAliveInterval 30
ServerAliveCountMax 120

5. Perhaps you have both a Grid and a VPS service with us. Here is an example file showing multiple hosts:

Host VPS

User ftpuser
ServerAliveInterval 30
ServerAliveCountMax 120

Host grid

ServerAliveInterval 30
ServerAliveCountMax 120


  • Running the command "man ssh_config" in a Terminal will show you detailed usage information.
  • OpenSSH homepage, including a section on ssh_config