LinuxQuestions.org
Visit Jeremy's Blog.
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
 
Search this Thread
Old 12-31-2012, 10:56 PM   #1
vjramana
Member
 
Registered: Sep 2009
Posts: 88

Rep: Reputation: 0
ssh: connect to host 192.168.168.94 port 22: Connection refused


I am using ubuntu 11.10 as my desktop and centos 6 as a server.

I used to connect from ubuntu to centos using ssh. It was fine all the while.

Start from today, i can not ssh to my centos server.

When I type
Quote:
ssh vijay@192.168.168.94
Quote:
ssh: connect to host 192.168.168.94 port 22: Connection refused
I have tried to uninstall and re-installed openssh-server.
Upon re-install I can ssh to the server but for a while only ( about 20 minutes only ).
Suprisingly after that I get

Quote:
write failed broken pipe ssh
then I can not ssh anymore. Getting the same message
Quote:
ssh: connect to host 192.168.168.94 port 22: Connection refused

I tried this command
Quote:
ssh 192.168.168.94 -vvv
I get
Quote:
vijay@glycosim:~$ ssh 192.168.168.94 -vvv
OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.168.94 [192.168.168.94] port 22.
debug1: connect to address 192.168.168.94 port 22: Connection refused
ssh: connect to host 192.168.168.130 port 22: Connection refused
I dont know how to solve this matter.
Can I get any help?

Thanks so much in advance.

Last edited by vjramana; 12-31-2012 at 11:00 PM.
 
Old 01-01-2013, 05:21 AM   #2
bijo505
Member
 
Registered: Nov 2012
Location: Bangalore
Distribution: Fedora & Ubuntu
Posts: 77

Rep: Reputation: 18
Hi,

It seems that sshd service is not running on the server.

Code:
#/etc/rc.d/init.d/sshd status
if it is running check the configuration file and find out the ssh listening port or run the following, that will help you to find out the listening port

Code:
# netstat -natlpe | egrep -i ssh
And after that enabling the batch mode by adding the following in your ssh user config file

Code:
vi  ~/.ssh/config
Host *
ServerAliveInterval 300
After this also, if you are not able to connect, disable iptables and then try to connect.

Code:
#/etc/rc.d/init.d/iptables stop
Also please have a look at the following URL
http://www.cyberciti.biz/faq/centos-ssh/
--
Thanks,
Bijo

Last edited by bijo505; 01-01-2013 at 05:37 AM.
 
1 members found this post helpful.
Old 01-01-2013, 06:14 AM   #3
vjramana
Member
 
Registered: Sep 2009
Posts: 88

Original Poster
Rep: Reputation: 0
Hi bijo505,

for your first command I get

Quote:
openssh-daemon (pid 3276) is running...
for the second command I get

Quote:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 14338 3276/sshd
tcp 0 0 192.168.168.xxx:22 192.168.168.yy:58041 ESTABLISHED 0 21217 4275/sshd
tcp 0 0 192.168.168.xxx:22 192.168.168.yy:58044 ESTABLISHED 0 25012 5181/sshd
tcp 0 0 :::22 :::* LISTEN 0 14336 3276/sshd
(simply changed the IP numbers with xxx and yy)


For the third change as below
Code:
vi  ~/.ssh/config
Host *
ServerAliveInterval 300
I dont have config file at the location you mentioned above.
Shall i create one?

Thank you
 
Old 01-02-2013, 06:56 AM   #4
bijo505
Member
 
Registered: Nov 2012
Location: Bangalore
Distribution: Fedora & Ubuntu
Posts: 77

Rep: Reputation: 18
Hi,

You can create that config file. Are you able to ssh to the server from the server and any other hosts now? Can you please check the sshd_config file and if you can attach the same here, it will help to have a look at the config.
--
Thanks,
Bijo
 
Old 01-03-2013, 02:51 AM   #5
vjramana
Member
 
Registered: Sep 2009
Posts: 88

Original Poster
Rep: Reputation: 0
Hi Bijo,


I created the config file and changed its mode as below
Quote:
chmod 600 ~/.ssh/config
Now it is working fine.

Thank you so much for your help.
Regards
 
  


Reply

Tags
ssh, ssh access


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
rsync: failed to connect to 192.168.1.1: Connection refused (111) stevewuiyi Linux - Server 2 12-10-2009 09:35 AM
RSH connect to address 192.168.1.xxx port 544: Connection refused Permission denied chackercon Linux - Networking 8 04-23-2009 02:06 AM
What route to access daisy chained 2d router 192.168.1.1 after 192.168.0.1 (subnets?) Emmanuel_uk Linux - Networking 6 05-05-2006 01:47 AM
Is someone on my network?! ::ffff:192.168.0.10:ssh ::ffff:192.168.0.:38201 ESTABLISHE ming0 Linux - Security 4 04-12-2005 01:04 AM
[new bie] sshd: refused connect from 192.168.x.x jmcollin92 Linux - Security 2 12-14-2003 02:39 AM


All times are GMT -5. The time now is 03:39 PM.

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