Translation(s): none


This page will describe hot 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 through the config file in $HOME/.ssh. Create these if they don't already exist:

cd
mkdir .ssh
touch .ssh/config

Let's say that a user bob wants to ssh into a machine whose IP address is 192.168.1.15 and whose name is machina. Then he would add an entry like the following to config:

Host=machina
Hostname=192.168.1.15
User=bob

This assumes that bob's username on machina is also bob. And yes, the IP address really goes on the Hostname line.

Setting a static IP

As you can see, this "shortcut" is pretty worthless if machina gets its IP address through DHCP, because bob will have to edit his config file every time machina gets a new IP address.

See ?StaticIP to set static IP address for a given interface.

Usage

Now, bob can replace commands like:

% ssh bob@192.168.1.15
% scp bob@192.168.1.15:/home/bob/file.txt .

with:

ssh machina
scp machina:~/file.txt .

respectively.

See also

ssh_config(5) ?ssh


CategoryNetwork