3

Possible Duplicate:
Connect to Linux by name rather than IP

When I login I always do:

ssh [email protected]

Is it possible to do something like:

ssh myuser@server1

I would like to use a name, not an IP address, is it possible?

1

2 Answers 2

8

You can add a line to your ssh config file (often located at ~/.ssh/config):

Host server1
  HostName 111.111.111.111

This could be considered a little neater than editing the hosts file as it's user-specific.

1
  • 1
    You can also specify many other parameters --- read man ssh_config for more info
    – aland
    Sep 17, 2011 at 11:58
3

You can do that by adding the following line to the /etc/hosts

111.111.111.111 server1

below the line

127.0.0.1 localhost

You need to be root to be able to do that.

Not the answer you're looking for? Browse other questions tagged .