0

I tried for the first time to setup a ssh server following these steps on the server machine:

  1. Following this article, I installed sudo apt install openssh-server
  2. Following this question, I edited /etc/ssh/sshd_config and appended
    Port 22
    PermitRootLogin no
    AllowUsers usr
    
  3. Following the first article, sudo systemctl restart sshd.service
  4. Following this article I found my external IP address ip-add using this
  5. I tried to ssh from my server machine to the machine itself with ssh usr@ip-add

However I got this error message:

ssh: connect to host ip-add port 22: Connection refused
12
  • are able to ping IP address of the machine you would like to connect ? – rɑːdʒɑ Mar 8 '17 at 10:32
  • @Ten-Coin thanks to your comment, actually I couldn't ping it from my remote machine! But now another error came up, please look at the updated question – user6321 Mar 8 '17 at 10:37
  • execute ps -A | grep sshd and check that sshd is running – Yaron Mar 8 '17 at 10:39
  • @Yaron 25308 ? 00:00:00 sshd – user6321 Mar 8 '17 at 10:39
  • 3
    Are you trying this with an external internet IP address? If so you're probably not reaching your remote machine, as you'll be bouncing off of the router. If this is the case you should look at port forwarding options. – Arronical Mar 8 '17 at 10:43
0

I solved the problem by creating a port-forwarding on my router.

3
  • You should accept your own answer to the question by clicking on the grey tick/check on the left hand side of the answer. – Arronical Mar 8 '17 at 12:11
  • @Arronical I can't before 2 days – user6321 Mar 8 '17 at 12:21
  • You might add some info to the question to indicate your problem was related to accessing your server remotely through a router. – jtessier72 Jun 19 '20 at 16:14

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.