[SOLVED] Port 22 refuses connection + ssh new port not working anymore

Just sudo nano /etc/ssh/sshd_config
Change port number to 22 (line 7)
Go to yunohost webadmin > services > ssh > start

the line with Port is 15 and it’s already set at 22.
i also checked ssh status and it was saying active.

then i rebooted out of the rescue access and went to the webadmin, but ssh still failed and clicking start doesn’t activate it.

i got this error

Error: "500" Internal Server Error

Action: "PUT" /yunohost/api/services/ssh/start

Error message:
Could not start the service 'ssh'

Recent service logs:-- Journal begins at Thu 2022-09-15 00:26:29 CEST, ends at Mon 2023-01-02 00:27:17 CET. --
Sep 15 00:26:29 sshd[29557]: Connection closed by 165.22.220.65 port 57428 [preauth]
Sep 15 01:17:35 sshd[29946]: Connection from 196.201.229.2 port 48428 on 173.249.30.166 port 1312
Sep 15 01:17:35 sshd[29946]: Connection closed by 196.201.229.2 port 48428 [preauth]
Sep 15 01:20:36 sshd[29966]: Connection from 23.126.62.36 port 33950 on 173.249.30.166 port 1312
Sep 15 01:20:36 sshd[29966]: Connection closed by 23.126.62.36 port 33950 [preauth]
Sep 15 01:26:58 sshd[29984]: Connection from 171.244.139.236 port 31555 on 173.249.30.166 port 1312
Sep 15 01:26:59 sshd[29984]: Connection closed by 171.244.139.236 port 31555 [preauth]
Sep 15 01:27:28 sshd[29988]: Connection from 200.70.56.203 port 50022 on 173.249.30.166 port 1312
Sep 15 01:27:28 sshd[29988]: Connection closed by 200.70.56.203 port 50022 [preauth]

it goes on for way longer, but it’s a repetition of the same lines.
and these are ssh logs.

It seems that the rescue mode alters sshd_config file. Try looking for the port number you used while in rescue mode, may be it’s commented

can’t find it.
i also gave a look around, but nothing about it and couldn’t find anything useful online.

in the /etc/ssh/ directory i can see:

:/etc/ssh# ls -a
.           ssh_config.d        ssh_host_ecdsa_key.pub    ssh_host_rsa_key.pub
..          sshd_config         ssh_host_ed25519_key
moduli      sshd_config.d       ssh_host_ed25519_key.pub
ssh_config  ssh_host_ecdsa_key  ssh_host_rsa_key

don’t know if any of these can be useful?

but, as you said, seems like the rescue system modify the whole ssh stuff, so i might also try to contact the vps company to see if they can help.

accessed my server through vnc and fixed the port issue.

ive also done this passage as well of the security section so i might call it a day for today.

thank you for the help.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.