LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   In SSH, how to replace a full domain name with an alias (https://www.linuxquestions.org/questions/linux-newbie-8/in-ssh-how-to-replace-a-full-domain-name-with-an-alias-364529/)

zbinwu 09-18-2005 11:09 AM

In SSH, how to replace a full domain name with an alias
 
Usually, I need to type "ssh eden.rutgers.edu" 20 times everyday. It is bothering to type the whole domain name everytime.
What changes can I do in Linux to make "ssh eden" works instead?

Thanks a lot!

macemoneta 09-18-2005 11:20 AM

You can set an alias in your .bash_profile (or the profile for whatever shell you are using). For example:

alias eden='ssh eden.rutgers.edu'

You can issue the command manually, to have it take effect immediately (it will automatically get set at your next login).

Now you can just enter:

eden

and the ssh command will get executed.

vimal 09-19-2005 07:15 AM

Hi zbinwu,
besides adding an alias, you can also add an entry to your "/etc/hosts" file.
the syntax is := IP address FQDN Hostname

ie... you can use:= 192.168.10.11 eden.rutgers.edu eden

now you can use the command " ssh eden" to connect..
vimal....

protozorq 04-18-2012 04:33 AM

Another search entry in /etc/resolv.conf was the better solution for me.

Read

man resolv.conf

for more details.

descendant_command 04-18-2012 05:07 AM

Another way is simply make or edit ~/.ssh/config with
Code:

host big
hostname big.long.com
port 7654

then just
Code:

ssh big

ratotopi 04-20-2012 12:07 PM

@protozorq /etc/resolv.conf file is where you enter the DNS name, you will have to use the way vimal suggested or use the alias as macemoneta suggested. what you did is not correct though it will give you the desire output.

protozorq 04-23-2012 06:47 AM

Excerpt from the manpage:

"search Search list for host-name lookup.
The search list is normally determined from the local domain
name; by default, it contains only the local domain name. This
may be changed by listing the desired domain search path follow‐
ing the search keyword with spaces or tabs separating the names."

This is for intranet networks with multiple sub-domains and thus it
works great for me.

The actual reason I looked again into this forum is, that it does not work
with DHCP clients. Those need an entry like

append search-domain "incredible.super.long.org"

in /etc/dhcp/dhclient.conf instead.


Greetings.

descendant_command 04-23-2012 07:14 AM

But you don't need to mess with your DNS at all...


All times are GMT -5. The time now is 04:01 PM.