ssh: connect to host localhost port 22: Connection refused [closed]
Fire this command:
sudo iptables -L
If you see that no traffic is allowed (i.e. no specific rules), then run the following command:
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
this command tells the system to allow incoming connections to port 22...and usually should solve your dilemma, specifically for ssh
/ sshd
.
UPDATED as of July 31,2016:
iptables have nothing to do with ssh as an application, but on other hand, functions as router in allow the traffic to port 22. When using iptables, the system actually understand 'ssh' however, it's a shortcut within command line but, really, it's actually iptables INPUT -p udp -dport 22
while --dport means "destination port" (ssh uses port 22). This probably caused some misconception on seeing 'ssh' as if it's an appication, but really '22' as port.