LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-26-2006, 05:52 PM   #1
JohnLocke
Member
 
Registered: Jun 2004
Location: Denver, Colorado
Distribution: Ubuntu
Posts: 240

Rep: Reputation: 31
IP alias? Machine name alias?


I'm sure this is a fairly simple question and answer, but I don't even know the right words to ask it. I've got two computers that aren't on the same network which I log in to remotely (using ssh). I know I can make an alias, but I'm wondering if there's a more "correct" way to tell the computer that "Lenny" is at 6.16.xxx.xxx and "Bugz" is at 168.2.xxx.xxx.

Is there something like an /etc/machine file where I can set that information so later I can just type "ssh Lenny" or "sftp Bugz" and get to the right box?

Thanks ... and if you could tell me the correct way of /describing/ this problem, I'd be happy to look at a manual already out there somewhere.
 
Old 08-26-2006, 06:05 PM   #2
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
The file /etc/hosts is used for that put the machine address then name on a line by themselves then you can use them in the command an example of the file.

Code:
6.16.xxx.xxx Lenny
168.2.xxx.xxx Bugz
Of course changing the xxx to the proper numbers do this on both machines if you want to do it from each to the other.
 
Old 08-26-2006, 06:07 PM   #3
ph0b0s
Member
 
Registered: Aug 2005
Location: Belgium
Distribution: Debian, after testing all the others!
Posts: 41

Rep: Reputation: 15
Quote:
Originally Posted by JohnLocke
I'm sure this is a fairly simple question and answer, but I don't even know the right words to ask it. I've got two computers that aren't on the same network which I log in to remotely (using ssh). I know I can make an alias, but I'm wondering if there's a more "correct" way to tell the computer that "Lenny" is at 6.16.xxx.xxx and "Bugz" is at 168.2.xxx.xxx.

Is there something like an /etc/machine file where I can set that information so later I can just type "ssh Lenny" or "sftp Bugz" and get to the right box?

Thanks ... and if you could tell me the correct way of /describing/ this problem, I'd be happy to look at a manual already out there somewhere.
/etc/hosts

edit : ok happytux was faster

Last edited by ph0b0s; 08-26-2006 at 06:08 PM.
 
Old 08-26-2006, 07:01 PM   #4
JohnLocke
Member
 
Registered: Jun 2004
Location: Denver, Colorado
Distribution: Ubuntu
Posts: 240

Original Poster
Rep: Reputation: 31
Grrr ... I probably should have known that.

Anyway ... thanks much for the answer! That works brilliantly.
 
Old 01-16-2008, 12:21 PM   #5
jakev383
QmailToaster Developer
 
Registered: Dec 2005
Location: Burlington, NC
Distribution: CentOS, Voyage, Debian, Fedora
Posts: 220

Rep: Reputation: 31
You can also add them to your ssh file (/etc/ssh/ssh_config in RH distros) like this:
Code:
host fileserver
     hostname 192.168.0.4
     Port 5781
     UserKnownHostsFile ~/.ssh/fileserver
Especially useful when you put SSH on a port other than 22 - you can then just:
Code:
ssh fileserver
and it will connect to IP address 192.168.0.4 on pot 5781 for you. I find this especially useful if you manage multiple machines.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Alias question (2 commands for one alias) gflores Linux - Newbie 3 01-21-2006 12:40 AM
alias help jfauteux Linux - Software 3 04-08-2005 12:56 PM
alias xviddivxoggmp3 Slackware 9 01-25-2005 10:05 AM
ip alias mindcry Linux - Networking 0 10-16-2003 07:41 PM
alias booyah Slackware 3 05-06-2003 03:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration