Translation(s): none


This page will describe how to set up one or more SSH aliases. An SSH alias is a name used to refer to an SSH server or host on your network. If you have to run a lot of SSH comands, setting an alias can save you a lot of typing.

Setup

SSH aliases are configured on /etc/ssh/ssh_config (system-wide) or the the config file in $HOME/.ssh for user specific configuration.

You may need to create the user configuration file if it doesn't already exist:

cd
mkdir .ssh
chmod 700 .ssh
touch .ssh/config

Usage

Let's say that you want to log into a machine. Normally you need to do

$ ssh mj2287@123.123.123.123:2222:/home/http

but it gets boring quickly.

Adding that information to your config file will simplify and reduce the number of keystrokes.

Host webserver
   Hostname 123.123.123.123
   Port 2222
   User mj2278

Now, you can replace the command to:

% ssh webserver

Notes on the configuration

The most comprehensive information is in the man page of ssh_config, but the basics are:

The line starting with

There are many other configuration available and needed. Pay special attention to disallowing password authentication, and using public key authentication or certificate authentication only.

See also

SSH Config file at ssh.com man 5 ssh_config ?ssh


CategoryNetwork