Hi,
Is there a way to create a symbolic link to an off-site server, such that I don't have to type in user@xxx.yyy.zzz.aaa.bbb.ccc?
Thanks!
PS: I need to know how to do this on OSX, and on Ubuntu 10.04. I'm pretty sure it's the same command.
Hi,
Is there a way to create a symbolic link to an off-site server, such that I don't have to type in user@xxx.yyy.zzz.aaa.bbb.ccc?
Thanks!
PS: I need to know how to do this on OSX, and on Ubuntu 10.04. I'm pretty sure it's the same command.
Last edited by lazyrussian; January 25th, 2011 at 02:58 AM.
If the IP is static, add an entry in /etc/hosts. E.g.
Then you can doCode:123.123.123.123 xxx.yyy.zzz.aaa.bbb.ccc shortnameCode:ssh user@shortname
Another option is of course to make a shell function (or alias).
Add it to the end of ~/.bashrc to make it permanent.Code:sshfoo() { ssh user@xxx.yyy.zzz.aaa.bbb.ccc "$@"; }
Thanks! Modifying /etc/hosts worked perfectly!
ssh has its own mechanism for this, you don't need to touch /etc/hosts. You can do something like in your local ssh_config
This tells ssh that hostname shortcut has a known_hosts keyname of hostkeyalias, a real ip address or DNS host name of longame_or_ip_address, and an ssh listen port number of non_standard_port_number. This entry would reduce the ssh login command fromCode:host shortcut hostkeyalias name_in_known_hosts_file hostname longame_or_ip_address port non_standard_port_number
toCode:ssh -p non_standard_port_number -o HostKeyAlias name_in_known_hosts_file \\ user@longame_or_ip_address
The hostkeyalias and port entries are extremely useful if you are contacting a host via port forwarding through a gateway machine. man ssh_config for more.Code:ssh user@shortcut
yeah, don't use hosts for "shortcuts" for ssh, if it's needed system and DNS is not an option for w/e reason, then use hosts. otherwise, use ssh_config.
I am infallible, you should know that by now.
"My favorite language is call STAR. It's extremely concise. It has exactly one verb '*', which does exactly what I want at the moment." --Larry Wall
(02:15:31 PM) ***TimToady and snake oil go way back...
42 lines of Perl - SHI - Home Site
So, why are you guys against editing /etc/hosts?
- Because you wind up hard coding something that is potentially dynamic and might change in an important system file that directly effects TCP/IP behaviour. You can be left with really hard to diagnose network problems at some time in the future.
- Because it isn't always practical or possible for users to edit the hosts file, and if they did they would be propagating their personal customizations system and possibly network wide, if the host in question runs certain flavours of DHCP or caching DNS server.
- Because SSH already provides a secure, local user level mechanism which has no effect on other users or system/network wide TCP/IP behaviour specifically for the purpose you are asking about.
Also, you mentioned OS X. Here is an interesting question: How many hosts files are there on a standard OS X installation? If the answer is more than one , which should you edit, and what happens when you reboot or install operating system upgrades? The answers to all three questions might surprise you.....
To my knowledge, there is only one hosts file. I edited it, and everything started working. Apparently, I had edited it in the past (2 years ago). In those 2 years, I forgot that that was the file I needed to edit, and that's what prompted my initial forum post.
I am the only user on my computer, so I grant myself superuser access when I need it. I do see the problem of doing this for users who don't have SU access.
Thanks for the explanation - much appreciated!
Bookmarks