i recently decided to turn my old desktop pc into a linux server where i can host my files etc. I followed a tutorial which used openssh and after installing it and configuring some files it works like a charm. I have a few questions though: the tutorial i followed here uses nc -v -z [addr] [port] to check if the ssh service is working on that port. However, no matter which port i use in the sshd_config file, it won't successfully listen on that port. Any ideas why?

PS: i'm a complete beginner to linux :)

*Running on Ubuntu 18.04LTS

  • Are you running the nc command with the loopback address as shown in the guide you linked? from where are you running the command? – steeldriver Feb 21 at 1:31
  • @steeldriver no,I'm using the local one and I'm running it from /home – Stelios Papamichail Feb 21 at 1:42

sshd, the ssh server, reads its config file (/etc/ssh/sshd_config) on sshd startup.

sudo service sshd restart

is one way to make this happen.

  • No, it will not. It will cause it to no longer accept new sessions on the old port, but existing sessions will be allowed to proceed. – Wouter Verhelst Feb 21 at 9:01
  • So should i try this or is it "dangerous"? – Stelios Papamichail Feb 22 at 12:54
  • You should try it. What makes you think it's "dangerous"? You can see which port sshd is listening to by sudo lsof -c sshd -a -i – waltinator Feb 22 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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