I'm trying to set up a headless machine running manjaro. I install and enable openssh, and can ssh localhost, but can't ssh by another machine. Plus, if I modify the /etc/ssh/sshd_config I cannot even ssh localhost anymore. I tried with Debian and it works as long as I don't modify the listening port... What in the world! Of course all ports are correctly forwarded. I'm not doing anything fancy, if I just change the port and uncomment it breaks (yes, the port I switch to is forwarded). What's going on?

closed as unclear what you're asking by Jakuje, Stephen Kitt, jimmij, Anthon, Thomas Dickey Jun 18 '16 at 23:23

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • is selinux activated? – Rui F Ribeiro Jun 18 '16 at 14:23
  • Try to ssh to the machine using ssh -vvv user@remote -p1234 where 1234 is the default port. Don't forget to restart sshd after you modify the sshd_config file. Also what do you mean by forwarding ? – Valentin Bajrami Jun 18 '16 at 14:24
  • Check the error logs. – Jakuje Jun 18 '16 at 14:38
  • No, SELinux is not active, all I did is installing openssh. – Dom Jun 18 '16 at 15:02
  • @val0x00ff it simply says "no route to host". As for the "forwarding" part, it means the ports are open both on the router and on the firewall – Dom Jun 18 '16 at 15:04

If you can SSH to localhost, but you can't SSH from another machine, then either you changed the SSH configuration to forbid SSH from other machines, or there's a firewall that blocks incoming SSH connections. The firewall could be on the same machine, or on any hop between the client you're testing from and that server.

If SSH works on the default port but not after changing it to listen to another port, that means that there's a firewall that blocks the port you chose. That, or you made a mistake when changing the configuration — since you didn't post your configuration attempt, we can't help you if you made a mistake there.

  • As I said, the ports are forwarded correctly. I can ssh localhost only if I uninstall and reinstall openssh, but if I change sshd_config it's done, it doesn't work anymore, if I uncomment whatever line it doesn't work, I'm not tinkering with it, if I check the status of sshd.service i get red messages stating "(code=exited, status=255)" and "failed to start OpensSSH Daemon" – Dom Jun 19 '16 at 0:44
  • I tried stopping sshd.service, modifying one line of the file, then startiuthe service again, it all went good untill I changed "login grace time" to "30s" instead of "2m", then when I started the service it was broken, changing it back solves nothing, nor does modifying the file to factory values or rebooting. I don't see any pattern in this behavior. I don't know why putting a space after # worked, but it did for some time... It's surreal! – Dom Jun 19 '16 at 1:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.