Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Connect to Linux by name rather than IP

When I login I always do:

ssh myuser@

Is it possible to do something like:

ssh myuser@server1

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

share|improve this question

migrated from Sep 17 '11 at 11:35

This question came from our site for professional and enthusiast programmers.

marked as duplicate by grawity, slhck, Nifle, Ƭᴇcʜιᴇ007, 8088 Nov 7 '11 at 15:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

somewhat related to Connect to Linux by name rather than IP – grawity Sep 17 '11 at 11:45
up vote 7 down vote accepted

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

Host server1

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

share|improve this answer
You can also specify many other parameters --- read man ssh_config for more info – aland Sep 17 '11 at 11:58

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

below the line localhost

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

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.