LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 12-23-2009, 05:22 AM   #1
peeths003
Member
 
Registered: Jun 2008
Distribution: Fedora 12 i686, Debian 5.0.1 i686, Fedora 14 x86_64, Debian Lenny 5.0.1x86_64 and CentOS_5.4_x86-64
Posts: 311

Rep: Reputation: 32
ssh login using hostname


Hi , I am trying to login to my CentOS machine through ssh using the host name , I am not able to do that . it says cannot find.

Quote:
vi /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 Peeths001
::1 localhost6.localdomain6 localhost6
Quote:
[root@Peeths001]# hostname
Peeths001
Quote:
[peeths@Peeths001 ~]$ uname -a
Linux Peeths001 2.6.18-164.9.1.el5 #1 SMP Tue Dec 15 20:57:57 EST 2009 x86_64 x86_64 x86_64 GNU/Linux
But when i Use the ip address I am able to login. What is that I am missing ?

I dont have any entries on /etc/hosts.allow and /etc/hosts.deny

Thanks
Peeths
 
Old 12-23-2009, 05:34 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
Hi,

You do not mention the ssh command you used, and it would be nice to have the actual error message(s).

Although I don't think it will solve the problem, I do believe that you should change the 127.0.0.1 entry to this:
127.0.0.1 localhost localhost.localdomain peeths001
I also changed the capital P into a lowercase p, not sure if capitals are allowed...

BTW: Try ssh -v <rest of your command> to get some more verbose output.

Hope this helps.
 
Old 12-23-2009, 05:40 AM   #3
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,183

Rep: Reputation: 113Reputation: 113
Are you trying ssh localhost itself using hostname or trying from remote system?
if remote system you should add ip and hostname on remote system hosts file too
 
Old 12-23-2009, 05:48 AM   #4
peeths003
Member
 
Registered: Jun 2008
Distribution: Fedora 12 i686, Debian 5.0.1 i686, Fedora 14 x86_64, Debian Lenny 5.0.1x86_64 and CentOS_5.4_x86-64
Posts: 311

Original Poster
Rep: Reputation: 32
I am trying to access from a windows machine using putty. The message that i am getting . Could not connect to peeths001 Host does not exist.
 
Old 12-23-2009, 05:49 AM   #5
peeths003
Member
 
Registered: Jun 2008
Distribution: Fedora 12 i686, Debian 5.0.1 i686, Fedora 14 x86_64, Debian Lenny 5.0.1x86_64 and CentOS_5.4_x86-64
Posts: 311

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by kirukan View Post
Are you trying ssh localhost itself using hostname or trying from remote system?
if remote system you should add ip and hostname on remote system hosts file too
does that means that I have to add that to the client ( windows ) machine about this details ?
 
Old 12-23-2009, 05:50 AM   #6
peeths003
Member
 
Registered: Jun 2008
Distribution: Fedora 12 i686, Debian 5.0.1 i686, Fedora 14 x86_64, Debian Lenny 5.0.1x86_64 and CentOS_5.4_x86-64
Posts: 311

Original Poster
Rep: Reputation: 32
this is how my /ets/hosts looks now


Quote:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost peeths001
::1 localhost6.localdomain6 localhost6
 
Old 12-23-2009, 06:14 AM   #7
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,183

Rep: Reputation: 113Reputation: 113
Quote:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost peeths001
::1 localhost6.localdomain6 localhost6
how does remote system know about peeths001?
you should have either DNS server or add hostname and corresponding ip at your remote system hosts file too. i mean if you want to access from windows machine using hostname then you should add your linux server ip and hostname in windows hosts file
 
Old 12-23-2009, 06:26 AM   #8
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
Hi,

I agree with kirukan, windows needs to know where to find the linux box (did you already set up a network?).

Another thing: 127.0.0.1 is for local use only (it is the machine itself, your windows box also has a 127.0.0.1 address).
 
Old 12-23-2009, 07:46 AM   #9
peeths003
Member
 
Registered: Jun 2008
Distribution: Fedora 12 i686, Debian 5.0.1 i686, Fedora 14 x86_64, Debian Lenny 5.0.1x86_64 and CentOS_5.4_x86-64
Posts: 311

Original Poster
Rep: Reputation: 32
cool ... that did the trick .
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh login issues : hostname phody_lee Linux - Networking 5 04-15-2009 05:29 AM
SSH Problem - Can't login using Hostname, can login using ip address jqweezy Linux - Networking 7 01-26-2009 02:21 PM
ssh login using hostname linuxguy08 Linux - Server 4 05-01-2008 08:03 PM
can't ssh using hostname deepesh1081 Linux - Networking 1 05-06-2007 07:11 AM
can ssh by IP, can't by hostname. FLOODS Linux - Networking 7 09-19-2005 01:41 PM


All times are GMT -5. The time now is 09:42 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration