PDA

View Full Version : trying to ssh to linux from windows



tidy_boy
26th April 2006, 07:22 PM
Hey guys I am new to this so be gentle. I have got two pcs one has fedora core 5 and the other has windows xp.

I am trying to ssh to linux from windows using a program called putty.

I have the linux box connected to my router and my windows pc which are both using dhcp.

I am loading putty and adding the host name like it says and adding localhost but I get a error saying Network refused.

What am I doing wrong?


Thanks

SHtRO
26th April 2006, 07:25 PM
Have checked the firewall (iptables) settings on the Linux box?

It is likely you are blocking the SSHD port. You can check this using "System->Administration->Security Level and Firewall" from the main desktop menu.

tidy_boy
26th April 2006, 07:26 PM
I have enabled ssh on the firewall :D

ccrvic
26th April 2006, 07:36 PM
I am ... adding the host name ... and adding localhost

What hostname are you trying to connect to? What are you typing in the box?

Also, are you running any DNS servers, or are you relying on your router to do it for you?

Vic.

tidy_boy
26th April 2006, 07:39 PM
I am trying to connect to a fresh install of fedora core 5


Not to sure aboutt he dns servers.

ccrvic
26th April 2006, 07:40 PM
I am trying to connect to a fresh install of fedora core 5

Yes - so what *exactly* are you typing into the box on Putty?


Not to sure aboutt he dns servers.

Then you're almost certainly relying on your router.

Vic.

tidy_boy
26th April 2006, 07:41 PM
I am typing in localhost then I tried the ip for my linux box 192.168.1.65

No Joy :-(

ccrvic
26th April 2006, 07:54 PM
I am typing in localhost

That won't work. localhost is the local host, not a remote machine...


then I tried the ip for my linux box 192.168.1.65

OK, that stands a better chance (assuming it really is the address of your machine :-)

Firstly, make sure that sshd is running on your box - type "service sshd status". If it isn't running, type "service sshd start". You'll need to be root to start or stop the service.

If it is running, we'll need to dig a bit deeper...

Have you got ethereal installed? If not, do a "yum install ethereal-gnome".

Fire up ethereal, then go to Capture->Interfaces. Press the "Prepare" button against eth0.

In the "Capture filter" box, type "port 22". Check the "update list of packets in real time" box, and hit "Start".

Let us know if there's any traffic...

Vic.

SHtRO
26th April 2006, 08:01 PM
Also, if the "sshd" service turns out not to be running as Vic mentioned, you will want to run "system-config-services" (or System->Administration->Server Settings->Services from the menu) and set it to start on a regular basis.

tidy_boy
26th April 2006, 08:08 PM
This is what I got

ccrvic
26th April 2006, 08:10 PM
This is what I got

...No traffic.

OK, how are you configuring the firewall on this machine?

Vic.

tidy_boy
26th April 2006, 08:10 PM
I have not touched the firewall I have allowed ssh

SHtRO
26th April 2006, 08:14 PM
Vic, it looks like you have this under control with a very level head. It is possible his IP is wrong, because he's using DHCP on both boxes. Perhaps assigning on the linux box a fixed address from the LAN outside the range of the DHCP on the router is best. He should then be able to use host files on both machines to handle the name resolution without involving any DNS servers (which may not exist locally).

ccrvic
26th April 2006, 08:18 PM
I have not touched the firewall I have allowed ssh

Only one of those statements can be true :-)

How exactly are you configuring the firewall, and what are you doing?

If you haven't modified the firewall at all, the default config is to block port 22 (ssh).

Post the contents of /etc/sysconfig/iptables (if that's where it is in FC5! I'm sat at a RHEL4 box, so it might not be...)

Vic.

tidy_boy
26th April 2006, 08:20 PM
[root@localhost matt]# /etc/sysconfig/iptables
bash: /etc/sysconfig/iptables: Permission denied

ccrvic
26th April 2006, 08:27 PM
[root@localhost matt]# /etc/sysconfig/iptables
bash: /etc/sysconfig/iptables: Permission denied

Yes, you're trying to execute a file that isn't executable. That won't work.

Use "cat"or $YOUR_FAVOURITE_EDITOR.

Vic.

tidy_boy
26th April 2006, 08:28 PM
SO what do I do in the file ?

tidy_boy
26th April 2006, 08:29 PM
this is whats in that file


# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

tidy_boy
26th April 2006, 08:35 PM
Do I need to add anything to the router to get ssh working. Like ports etc?

tidy_boy
26th April 2006, 08:50 PM
Anyone I really need the help :D

tidy_boy
26th April 2006, 09:02 PM
Problem Sorted I just added the Ip address for my linux box manually :D Thanks Guys