Page 1 of 1

SSH Server alias

Posted: Thu Apr 03, 2003 6:59 am
by Heavy
I have a problem:

I access a server using ssh by typing this line:

Code: Select all

ssh -l username  hostname "some commands"
Bare with me, I'm an ssh newbie...

Now, I've read about making an "alias" to the host providing this functionality:

Code: Select all

ssh hostaliasincludingusername "some commands"
I got it from here:
http://classes.cs.kent.edu/sce/ssh.html
Cut from that page:

Code: Select all

Using SSH on Linux/UNIX

Students can access loki over a network using the full Internet name: loki.mcs.kent.edu. They would typically ssh into loki with X-Window tunneling enabled. The command to do this is:

ssh -X username@loki.mcs.kent.edu

Where username is your username on loki. The -X flag provides for X-Window tunneling.

You then have secure shell access to loki. In addition, any X-Window programs that you start in loki shell will be display, securely of course, on your local X-Windows server (the X-Windows that is running on your local computer).

ssh is very configurable and the above command can be easily shortened by configuration to:

ssh loki

To do this put the following in your ssh configuration file:

loki:
Host            loki.mcs.kent.edu
User            username
ForwardX11      yes

Check your documentation, using man or info on ssh, to see where this is.
I have crawled the Internet for about two hours not being able to find any more specific info on this subject. This is probably because I do not know what this type of "alias" is really called.

I want to add this functionality to my servers. Please, tell me which config file I should use. And if the example above (loki) is faulty, please correct it. I am getting nowhere by myself.

Thanks

Posted: Thu Apr 03, 2003 8:43 am
by Stoker
As described in that document, just put the alias def in your config file /home/username/.ssh/config

Posted: Fri Apr 04, 2003 3:16 am
by Heavy
Well. I tried that...

content of /home/heavy/.ssh/config:

Code: Select all

aliasedip:
Host host.domain.topdomain
User heavy
Shell cutout:

Code: Select all

їheavy@www .ssh]$ ssh aliasedip
/home/heavy/.ssh/config: line 1: Bad configuration option: aliasedip:
/home/heavy/.ssh/config: terminating, 1 bad configuration options
їheavy@www .ssh]$
Maybe its my ssh version?

Code: Select all

їheavy@www .ssh]$ ssh -V
OpenSSH_3.4p1, SSH protocols 1.5/2.0, OpenSSL 0x0090607f
їheavy@www .ssh]$

Posted: Fri Apr 04, 2003 8:18 am
by Stoker
oh, sorry I didn't look to hard on the details of the first post, not sure what that syntax is/was for, the syntax is

Code: Select all

host  thenickname
     hostname the.real.hostname
     user theusername

  host  *.mydomain.com
     user myuser

Posted: Fri Apr 04, 2003 8:30 am
by Heavy
Thanks! It worked well.