Re: Fwd: How to set hostnam alias
Eric Sorton <[email protected]> Fri, 2 Mar 2007 13:44:39 -0500
| Newsgroups | gmane.org.user-groups.linux.morlug |
|---|---|
| Message-ID | <20070302184439.GA10459@localnet> |
On Fri, Mar 02, 2007 at 10:47:56AM -0500, Andrei Smirnov wrote: > On 3/2/07, Andrei Smirnov <[email protected]> wrote: That's really > simple, I don't want to type: > > ssh smirnov.mae.wvu.edu > > all the time when I want to connect to remote host. > I just want to type: > > ssh smirnov > > I seem to have found the fix by writing: > > 0.0.0.0 smirnov.mae.wvu.edu smirnov > > into my /etc/hosts > > Andrei > From: Andrei Smirnov <[email protected]> > Date: Mar 2, 2007 10:45 AM > Subject: Re: [Morlug] How to set hostnam alias > To: Michael Bond <[email protected]> > > My fix above was a mistake! > It actually created aliases for my local host not for the remote one. > So, I still don't know how can I set alias for a remote host, so that instad > of using this command to login: > > ssh remotename.remotedomain.com > > I could use this: > > ssh remotename > > Considering that I do not know the remote IP. > Any suggestions? If you are only interested in the alias working with ssh, you can use the ssh config file. Steps below ... 1) Create a file called config in ${HOME}/.ssh on the localhost. 2) Add the following lines: Host smirnov smirnov.mae.wvu.edu HostName smirnov.mae.wvu.edu That should be it. You should be able to ssh to the remote host using smirnov or the full DNS name. You can alias it as many times as you like. There are a lot more options that can be added here as well. If your username's are different, you can use the "User" option to change the username when connecting to the remote host. If ssh is on a non-standard port, the "Port" option can be added. See ssh_config for additional details. Eric -- Eric F. Sorton <[email protected]>