LinuxQuestions.org
Review your favorite Linux distribution.
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 11-03-2011, 04:29 AM   #1
tariq
LQ Newbie
 
Registered: Nov 2011
Posts: 15

Rep: Reputation: Disabled
unable to connect to remote host using ssh


I am new to both linux and ssh, so finding it a bit difficult to login to a remote host using ssh..although i am able to ping the system, i am unable to ssh it..whenever i am issuing ssh, it keeps me on waiting and after some time i get connection time out message..need some help badly
 
Old 11-03-2011, 04:33 AM   #2
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,194
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
#vi /etc/ssh/sshd_config

ClientAliveInterval 60


restart the ssh service on both machines

Last edited by deep27ak; 11-03-2011 at 04:34 AM.
 
Old 11-03-2011, 04:54 AM   #3
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
On the server:
Is sshd running?
Is it properly configured? Can you ssh localhost successfully?
Is it setup to listen on a non standard port, and are you trying to connect using said port?
Is the firewall configured to allow ssh through?

On the client:
Is there a firewall blocking access to the relevant ssh port, on the client connection?
Are you trying to ssh via a domain name? Can you resolve the dns with "dig"?
Have you tried "ssh -vvv" for more information as to why it might be timing out?
Try nmapping the server, to see if ssh is open to you.
 
Old 11-03-2011, 04:59 AM   #4
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
Quote:
Originally Posted by deep27ak View Post
#vi /etc/ssh/sshd_config

ClientAliveInterval 60


restart the ssh service on both machines
ClientAliveInterval is how frequently the server will send a keep alive packet to the client to prevent it from disconnecting when the session is idle. The OP isn't able to connect at all, so its not a idle session timeout issue..
 
1 members found this post helpful.
Old 11-03-2011, 05:08 AM   #5
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,194
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
Red face

Quote:
Originally Posted by fukawi1 View Post
ClientAliveInterval is how frequently the server will send a keep alive packet to the client to prevent it from disconnecting when the session is idle. The OP isn't able to connect at all, so its not a idle session timeout issue..
with the amount of information I got that is the best I could say

OP should have given with all the related info
 
Old 11-03-2011, 09:41 AM   #6
Gune
LQ Newbie
 
Registered: Jan 2009
Posts: 8

Rep: Reputation: 0
It could also be a router issue. If there is a router in between you might need to forward the port, ssh is using port 22.

Gune.
 
Old 11-03-2011, 11:00 AM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Need more details about the two machines in question. Are they on the same local network? Either one behind a router/firewall? Are you connecting to their local IPs or their public IPs?
 
Old 11-04-2011, 02:13 AM   #8
tariq
LQ Newbie
 
Registered: Nov 2011
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by deep27ak View Post
#vi /etc/ssh/sshd_config

ClientAliveInterval 60


restart the ssh service on both machines
I have set the ClientAliveInterval..Still the problem persists.
 
Old 11-04-2011, 02:20 AM   #9
tariq
LQ Newbie
 
Registered: Nov 2011
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by fukawi1 View Post
On the server:
Is sshd running?
Is it properly configured? Can you ssh localhost successfully?
Is it setup to listen on a non standard port, and are you trying to connect using said port?
Is the firewall configured to allow ssh through?

On the client:
Is there a firewall blocking access to the relevant ssh port, on the client connection?
Are you trying to ssh via a domain name? Can you resolve the dns with "dig"?
Have you tried "ssh -vvv" for more information as to why it might be timing out?
Try nmapping the server, to see if ssh is open to you.
On the server:
Yes, the sshd is running
It is also configured(Do i need need something specific to be configured?)
Default port(22) is being used
I am not behind a firewall

On the client:
I am trying to ssh the remote host directly
I have also tried "ssh -v" but couldn't find much help
If possible could you please let me know about "how to nmap the server"?
 
Old 11-04-2011, 02:21 AM   #10
tariq
LQ Newbie
 
Registered: Nov 2011
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Gune View Post
It could also be a router issue. If there is a router in between you might need to forward the port, ssh is using port 22.

Gune.
I am not using any router Gune
 
Old 11-04-2011, 02:25 AM   #11
tariq
LQ Newbie
 
Registered: Nov 2011
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
Need more details about the two machines in question. Are they on the same local network? Either one behind a router/firewall? Are you connecting to their local IPs or their public IPs?
Yes, they both are on the same local network and none of them is behind a router or firewall. And i am trying to connect to its local IP
 
Old 11-04-2011, 02:44 AM   #12
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
Quote:
Originally Posted by tariq View Post
Yes, the sshd is running
is it listening on the right address?
Code:
netstat -tnlp
Should show you what address it is listening on.

Quote:
Originally Posted by tariq View Post
It is also configured(Do i need need something specific to be configured?)
Is root login disabled, and your trying to login as root? ssh (client) will automatically try to log you in as the user you are logged in as, so if you are logged into the client as root, it will try to log you into the server as root via ssh. You can use, ensuring $username exists on the server. Although, this should give you an error, rather than a timeout.
Code:
ssh $username@x.x.x.x
It could also be a hosts problem, check your hosts.deny and hosts.allow files in /etc/.

Quote:
Originally Posted by tariq View Post
If possible could you please let me know about "how to nmap the server"?
Install nmap
Code:
# yum (apt-get, etc) install nmap
Code:
# nmap x.x.x.x
Should be enough if there is nothing fancy going on in the way of firewalls/etc..
It should give you a list of ports on the server, that are open to the client..

ssh has multiple levels of verbosity, which can be set by using "-vvv" which may give you more information.
 
Old 11-04-2011, 02:48 AM   #13
tariq
LQ Newbie
 
Registered: Nov 2011
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by fukawi1 View Post
is it listening on the right address?
Code:
netstat -tnlp
Should show you what address it is listening on.


Is root login disabled, and your trying to login as root? ssh (client) will automatically try to log you in as the user you are logged in as, so if you are logged into the client as root, it will try to log you into the server as root via ssh. You can use, ensuring $username exists on the server. Although, this should give you an error, rather than a timeout.
Code:
ssh $username@x.x.x.x
It could also be a hosts problem, check your hosts.deny and hosts.allow files in /etc/.


Install nmap
Code:
# yum (apt-get, etc) install nmap
Code:
# nmap x.x.x.x
Should be enough if there is nothing fancy going on in the way of firewalls/etc..
It should give you a list of ports on the server, that are open to the client..

ssh has multiple levels of verbosity, which can be set by using "-vvv" which may give you more information.
Thank you so so much fukawi1..I will do as you have told me to do and let you know the progress.
 
Old 11-04-2011, 03:04 AM   #14
tariq
LQ Newbie
 
Registered: Nov 2011
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by fukawi1 View Post
is it listening on the right address?
Code:
netstat -tnlp
Should show you what address it is listening on.


Is root login disabled, and your trying to login as root? ssh (client) will automatically try to log you in as the user you are logged in as, so if you are logged into the client as root, it will try to log you into the server as root via ssh. You can use, ensuring $username exists on the server. Although, this should give you an error, rather than a timeout.
Code:
ssh $username@x.x.x.x
It could also be a hosts problem, check your hosts.deny and hosts.allow files in /etc/.


Install nmap
Code:
# yum (apt-get, etc) install nmap
Code:
# nmap x.x.x.x
Should be enough if there is nothing fancy going on in the way of firewalls/etc..
It should give you a list of ports on the server, that are open to the client..

ssh has multiple levels of verbosity, which can be set by using "-vvv" which may give you more information.
When i tried to nmap the localhost i got the following output -

tariq@ubuntu:~$ nmap 192.168.2.106

Starting Nmap 5.21 ( http://nmap.org ) at 2011-11-04 12:30 IST
Illegal character(s) in hostname -- replacing with '*'
Nmap scan report for tariq*ubuntu (192.168.2.106)
Host is up (0.00015s latency).
Not shown: 999 closed ports
PORT STATE SERVICE
22/tcp open ssh

Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds

an when i namapped the remote host to which i am trying to connect i got this -

tariq@ubuntu:~$ nmap 192.168.2.75

Starting Nmap 5.21 ( http://nmap.org ) at 2011-11-04 12:30 IST
Illegal character(s) in hostname -- replacing with '*'
Nmap scan report for syed*blr-ws-151 (192.168.2.75)
Host is up (0.0027s latency).
Not shown: 988 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
53/tcp open domain
80/tcp open http
110/tcp open pop3
139/tcp open netbios-ssn
143/tcp open imap
445/tcp open microsoft-ds
902/tcp open iss-realsecure
993/tcp open imaps
995/tcp open pop3s
8080/tcp open http-proxy

Nmap done: 1 IP address (1 host up) scanned in 0.07 seconds

By looking at this ssh seems to be fine to me..But i need your guidance
 
Old 11-04-2011, 03:11 AM   #15
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
Can you post the output of (on the server)
Code:
netstat -tnlp

Last edited by fukawi1; 11-04-2011 at 03:13 AM.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh can not connect remote host crazy6 Linux - Newbie 2 03-04-2011 08:28 PM
telnet: Unable to connect to remote host: No route to host grob115 Linux - Networking 3 07-30-2010 11:18 AM
Fedora 10/unable to ssh out from box to remote host (SSH within LAN ok) huskeypm Linux - Networking 3 04-14-2009 08:37 PM
telnet: Unable to connect to remote host: Connection refused stuckz Fedora 6 06-21-2007 03:36 AM
how 2 connect 2 remote host using SSH fhameed Linux - Networking 2 09-08-2004 09:42 PM


All times are GMT -5. The time now is 09:25 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration