SSH computer name/domain/hostname

I would like to apologise in advance since I’m not really able to express my problem using proper terminology.

I’m interested whether it’s possible to adjust settings of sshd or any other application so that I’ll be able to ssh login through LAN by using:

ssh username@elephant

instead of:

ssh username@212.235.209.220

where 212.235.209.220 is static address of said computer on LAN and elephant is a name of the computer (it’s also returned as hostname when using hostname command). I wasn’t successful googling it since I don’t know what to search for in the first place. I’m asking you in addition if anyone could briefly explain me what do the terms domain, hostname, fqdn mean in respect to ssh.

Thanks a lot!

It works for me. I have an entry in “/etc/hosts” which is, in essence, the equivalent of:


212.235.209.220    elephant

Another alternative is to add an entry to your personal “$HOME/.ssh/config”


Host elephant
        Compression     yes
        ForwardAgent    no
        ForwardX11      no
        HostName        212.235.209.220

The “Compression”, “ForwardAgent” and “ForwardX11” can be omitted, or changed to match your needs.

On Sat, 19 Jan 2013 01:26:01 +0000, Cr U wrote:

> I’m interested whether it’s possible to adjust settings of sshd or any
> other application so that I’ll be able to ssh login through LAN by
> using:
>
> ssh username@elephant
>
> instead of:
>
> ssh username@212.235.209.220

Three ways to do this:

  1. Set up DNS for your LAN
  2. Put an entry in the hosts file on the system that’s connecting to
    “elephant”
  3. Put an entry in ~/.ssh/config for “elephant” that sets options and
    points to the IP address in question.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

On Sat, 19 Jan 2013 01:26:01 +0000, Cr U wrote:

> I’m asking you in addition if
> anyone could briefly explain me what do the terms domain, hostname, fqdn
> mean in respect to ssh.

With respect to any application that uses names like you see in URLs (for
example, www.opensuse.org):

www = hostname
opensuse.org = domain
www.opensuse.org = fqdn (fully qualified domain name)

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

On 2013-01-19 02:26, Cr U wrote:

> I’m interested whether it’s possible to adjust settings of sshd or any
> other application so that I’ll be able to ssh login through LAN by
> using:
>
> ssh username@elephant
>
> instead of:
>
> ssh username@212.235.209.220

It doesn’t matter if it is ssh or any other tool: the computer where you
run it has to be able to find the address of the computer named
“elephant”. It is not something you do on the machine where the sshd
daemon runs, the server, but on the client.

Typically you edit the hosts file of all the client machines, or set up
a name server on the lan, and make all the machines use it.


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

Thank you all for responses and explainations!

I’m remotely connecting to this computer (elephant) through another computer, where I don’t have full permissions, so I’ll just edit my ‘~/.ssh/config’ on said intermediate client.

Cheers!