Quantcast
Viewing all articles
Browse latest Browse all 484

How to change sshd port and do it in wrong way?

@laks wrote:

Its a matter of two step process! First

Step 1) You need to have root (or sudo) permission to change/edit this file


/etc/ssh/sshd_config

Step 2) As you know sshd default listens on port 22, so find the line


#Port 22

and replace the port number to something else


#Port 12345

That's it . right ?

Now login to your server with above port


ssh -p 12345 user@serverip

You must get an error message like


ssh: connect to host serverip port 12345: Connection refused

Why it didn't work ?

There are two mistakes we did while changing /etc/ssh/sshd_config file.

Mistake 1) We forgot to un-comment the line


#Port 12345

Every line beginning with # will be treated as comment. So you must un-comment that line first


Port 12345

Mistake 2) We didn't restart the sshd service. You must restart the sshd server to ensure these new changes are applied.


service sshd restart

And now login to your server with above port


ssh -p 12345 user@serverip

It should prompt you for password..

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 484

Trending Articles