LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 11-22-2009, 03:57 AM   #1
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 440

Rep: Reputation: 32
unable to ssh from one machine to another connected to the same wireless router


Hi!

I am trying to ssh between laptop1 (say 192.168.1.33, running Ubuntu 9.04) and laptop2 (192.168.1.39 running Ubuntu 9.10) both connected to the same router (192.168.1.1) wirelessly. Though I am able to ssh from laptop2 to laptop1, I am unable to do the vice-versa. Yes, openssh-server is installed and working on both the systems.

When I issue the following command from laptop 1 -
Quote:
$ ssh myname@192.168.1.39
I get the following message -
Quote:
ssh: connect to host 192.168.1.39 port 22: Connection refused
I have ufw installed on both the systems. I have added the rule -

Quote:
22 Allow Anywhere
to both. However, the connection is still being refused.



Any suggestions?

Thanking in advance,

Last edited by adityavpratap; 11-22-2009 at 03:58 AM. Reason: providing more information
 
Old 11-22-2009, 05:30 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Is the ssh deamon running?
What happens if you disable the firewall?
 
Old 11-22-2009, 05:49 AM   #3
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 440

Original Poster
Rep: Reputation: 32
Yes, ssh is running on both. I am able to ssh from laptop2 to laptop1. Even if I disable the firewall I am unable to disconnect.

Quote:
nmap localhost -p 22
reveals the port closed.
 
Old 11-22-2009, 05:51 AM   #4
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Is ssh running on port 22 ?
 
Old 11-22-2009, 07:02 AM   #5
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 440

Original Poster
Rep: Reputation: 32
Pardon my ignorance! but can you tell me how do I confirm whether ssh is running on Port 22 or not?
 
Old 11-22-2009, 07:58 AM   #6
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Look in the configuration files
/etc/ssh/sshd_config
To see if ssh running
Code:
ps ax | grep sshd
You need to restart the deamon if you make any changes

Last edited by repo; 11-22-2009 at 07:59 AM.
 
Old 11-22-2009, 08:46 AM   #7
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 440

Original Poster
Rep: Reputation: 32
Ok! sshd is listening to port 512. I started sshd by issuing the following command -
Quote:
$sudo /usr/sbin/sshd
but now when I try
Quote:
ssh 192.168.1.39 -p 512
I get the following message -
Quote:
Connection closed by 192.168.1.39

Last edited by adityavpratap; 11-22-2009 at 08:48 AM.
 
Old 11-22-2009, 09:14 AM   #8
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
To start/stop or restart sshd
Code:
sudo /etc/init.d/ssh start/stop/restart
Look in the logfiles to see what happens, or use
Code:
ssh -vvv 192.168.1.39

Last edited by repo; 11-22-2009 at 09:41 AM.
 
Old 11-22-2009, 09:33 AM   #9
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 440

Original Poster
Rep: Reputation: 32
Ok! I restarted ssh on the target laptop and issued
Quote:
ssh -vvv 192.168.1.39
from laptop2.

Here's the output -
Quote:
OpenSSH_5.1p1 Debian-5ubuntu1, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.39 [192.168.1.39] port 22.
debug1: connect to address 192.168.1.39 port 22: Connection refused
ssh: connect to host 192.168.1.39 port 22: Connection refused
 
Old 11-22-2009, 09:35 AM   #10
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Did you changed the conf file to listen on port 22, and restarted ssh ?
 
Old 11-22-2009, 09:39 AM   #11
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

If you ssh daemon on 192.168.1.39 is still listening on port 512 then you need to tell it that on the ssh command. The last one you issued is connecting on port 22 probably because you forgot to add the '-p' parameter.

Code:
ssh -vvv 192.168.1.39 -p 512
Try again with the command above and post the output.

Kind regards,

Eric
 
Old 11-22-2009, 10:08 AM   #12
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 440

Original Poster
Rep: Reputation: 32
Ok! There is some development! Actually there are two files in /etc/ssh - ssh_config and sshd_config. The former was listening to 22 and the later was listening to 512. So I changed the port to 22 in sshd_config.

Now ssh 192.168.1.39 gives the following output -
Quote:
OpenSSH_5.1p1 Debian-5ubuntu1, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.39 [192.168.1.39] port 22.
debug1: Connection established.
debug1: identity file /home/aditya/.ssh/identity type -1
debug1: identity file /home/aditya/.ssh/id_rsa type -1
debug1: identity file /home/aditya/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-6ubuntu2
debug1: match: OpenSSH_5.1p1 Debian-6ubuntu2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-5ubuntu1
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 192.168.1.39

Last edited by adityavpratap; 11-22-2009 at 10:15 AM. Reason: typographic error!
 
Old 11-22-2009, 10:59 AM   #13
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
What hapens when you connect from the computer 192.168.1.39?
Code:
ssh -vvv 127.0.0.1
 
Old 11-22-2009, 11:04 AM   #14
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 440

Original Poster
Rep: Reputation: 32
Yes, I tried that. But I got the same message I quoted earlier. Except for the IP address.
 
Old 11-22-2009, 11:12 AM   #15
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
I would suggest to copy the working sshd.conf file from the working laptop to 192.168.1.39
and restart sshd
 
  


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
unable to ssh into a machine.. wrapster Linux - Networking 8 08-24-2009 01:39 AM
Wireless status connected, cannot ping router. vivekjoshi Linux - Wireless Networking 3 02-27-2009 09:19 AM
How do connect to a machine behind a router with ssh mixtr Linux - Networking 10 03-20-2006 06:24 PM
unable to access machine on same router Harpune Linux - Networking 1 11-05-2005 01:22 AM
How to access MAC id of a machine in WAN set up thru router connected via ISDNline? Ramanathan Linux - Security 1 04-08-2004 02:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 05:14 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