Support / KnowledgeBase

 
Search the KnowledgeBase Search

Using an SSH Config File

  • Applies to: All Service Types

  • Difficulty: Hard

  • Time needed: 10 minutes

  • Tools needed: SSH, vi knowledge

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

Overview

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 DV server, including how to keep your connection active.

Requirements

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.
  • example.com 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.

READ ME FIRST

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.

Instructions

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

TIP:

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

touch /Users/username/.ssh/config

NOTE:

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 DV server:

Host dv

HostName example.com
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 DV service with us. Here is an example file showing multiple hosts:

Host dv

HostName dv.example.com
User ftpuser
ServerAliveInterval 30
ServerAliveCountMax 120

Host grid

HostName grid.example.com
User serveradmin@grid.example.com
ServerAliveInterval 30
ServerAliveCountMax 120

Resources

  • Running the command "man ssh_config" in a Terminal will show you detailed usage information.
  • http://www.openssh.com/manual.html OpenSSH homepage, including a section on ssh_config
 

Continue