You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to change ssh port?

Received Response
281
Views
1
Comments
in Linux 1 comment

Summary:

I add a new ssh port, but can't connect, report "Connection refused".

Content (required):

1) Security List ->Ingress Rules -> add port 2222

2) Use http to test the port 2222, access ok.

3) sudo vim etc/ssh/sshd_config

add "Port 2222" and restart sshd.

sshd status display "Server listening on 0.0.0.0 port 2222"

4) ufw status: inactive; iptables status: inactive (dead)

5) test local : ssh -p 2222 ubuntu@localhost access ok.

6) test remote access failed, report "Connection refused".


Version (include the version you are using, if applicable):

Ubuntu 22.04

Code Snippet (add any code snippets that support your topic, if applicable):

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!