My first attempt to solve this problem would be to
- open PuTTY
- select Session > Logging
- enable logging of SSH output to a file
- try to connect
- review the logfile
What does the logfile say? Anything that points you into a specific direction? It could me messages ranging from "Connection timed out" to "Access denied".
Connection timed out:
Make sure you really have the correct IP address and TCP port given in PuTTY's session options. If you are using a hostname instead of the IP address, make sure that the hostname resolves to the correct IP address. Eventually also check c:\system32\drivers\etc\hosts
.
If you have configured UFW firewall, but omitted to allow ssh connections, run sudo ufw allow ssh
on your server. Before this, you can test if this is the problem (isolate it) by temporary disabling the firewall on your server sudo ufw disable
and check if the issue is there. To re-enable run sudo ufw enable
.
Do you administer the SSH server? If so, make sure that SSH really listens on port 22; if not, either change /etc/ssh/sshd_config
on the server or adjust the port in PuTTY. Also check that iptables
will let your client's IP address pass through.
If you do not administer the SSH server, get in touch with the administrator.
I personally like to install knockd
on my SSH servers, so that I can only connect to them after knocking certain ports. Ask the administrator whether you have to do something like that.
Access Denied:
If you try to login as root
, chances are, that this is forbidden in /etc/ssh/sshd_config
on the server. Login with another / your username.
If you are using public key authentication, make sure that your private key
- is in PuTTY's
.ppk
format
- is entered in PuTTY's Connection > SSH > Auth section.
Also check whether the corresponding public key is in /home/yourusername/.ssh/authorized_keys
. Make sure that there are no line breaks (I am using nano
for that, and it sometimes adds linebreaks if I copy the key into it). A correct line should read like that, for instance for RSA: ssh-rsa ALOTOFCHARACTERS yourusername@hostname
.
So. First step: enable logging and post the output here. ;)
Start by checking firewall – hjpotter92 – 2014-05-01T05:41:59.337
i even disabled the firewall still its does the same thing – Waqas – 2014-05-01T05:50:49.840
1Knowing some more details would be useful. Is the Linux box on your local network? Can you connect to that server using another computer on your local network? Can you ping that server using your computer? In other words, do two things: 1) draw out the connection that should exist between your computer and the Linux box, and pinpoint where it is that it isn't working, and 2) see if SSH is the only connection that's failing. – Pockets – 2014-05-01T08:45:03.767
@SamuelLijin check the question now i have added the bullets – Waqas – 2014-05-01T21:53:29.307
Same network? Same Switch? Any NAT between? Where are the pcs that are able to connect? – davidbaumann – 2014-05-02T05:52:42.713
You still haven't specified whether these machines are on the same network and under what conditions you can use other machines to access the Linux box; are these other machines on the same subnet? Are you using the wifi at your local Starbucks? These are all variables you need to consider. If it's not on your local network, the problem could very well be out of your control (if you're trying to access a Linux box at home from a Win8 machine at work, maybe it's a company firewall!). You need to pinpoint exactly what the symptoms of your problem are, not just a broad description. – Pockets – 2014-05-02T08:13:15.627