0

I have just installed Linux Debian 7.8 on my VMWARE. Installed SSH and SSH-Server.

I'm able to connect via putty with the local IP (192.168.x.x). When I try to connect from another computer after startup I get the error connection timed out. I have already a fix for this but I think that it isn't the right one. I connect local with putty and than I can connect via the internet. Is there a way I can solve this problem so I can connect via the internet with putty to Linux Debian?

I have already forwarded the port 22 on my router. My IP is static.

0

2 Answers 2

2

It's best practice to run ssh on a different port then port 22 to start with. You can change this in /etc/ssh/sshd_config by changing the value for Port 22.

If you for example run ssh on port 8822, open this port on your firewall (and on the linux host if you are running a firewall there), you should be able to connect using ssh <your_user>@<your_public_ip> -p 8822. That is of course if your provider is not blocking any ports.

Edit: Additionally you might want to enfore pki authentication by setting PermitRootLogin prohibit-password in /etc/ssh/sshd_config. Furthermore you should use long and reasonably complex passwords/phrases. (As suggested by telcoM)

4
  • No matter which port you're using, I'd strongly recommend configuring any internet-facing sshd to accept key authentication only. If that is not possible, at least set PermitRootLogin prohibit-password in /etc/ssh/sshd_config and use long and reasonably complex passwords/phrases. Even though your ssh service might be in a non-default port, eventually some automated malware will scan all the ports on your public IP address, find it and start attempting to guess passwords on it.
    – telcoM
    May 31, 2018 at 12:05
  • Totally agree on your suggestion @telcoM
    – inaki
    May 31, 2018 at 12:27
  • I thought so :-) Feel free to add the recommendation to your answer if you want.
    – telcoM
    May 31, 2018 at 14:11
  • @telcoM done :)
    – inaki
    May 31, 2018 at 15:16
0
  1. check port 22 if it's open (for example with nmap) from outside
  2. there might be redirection issue which I experienced... when router uses port 22 for ssh configuration there is no possibility to redirect it even if it looks that you have configure it right. (Thats what I experienced on some microtik devices without any error or warn in it's log)

Try to configure your router to redirect port 222 on wan IP to port 22 on your local IP on your virtual machine.

1
  • 1
    ... And then test with ssh -p 222 {remote-host} Feb 20, 2015 at 18:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .