How To Change ssh Port in Linux & why ?

There is a security risk if you are using default ssh port which is 22 Because Hackers can scan for port 22 (default port for ssh protocol) to find computers with ssh running, and then they attempt a brute-force attack on that machine, so let us lower the risk and change ssh port in linux box.

So our task is How To Change ssh Port in Linux

Default = 22
We are going to  change with = 7878

`

Fist Edit ssh config file

# vi /etc/ssh/sshd_config

Uncomment this line and change port 22 to 7878

like this

Port22

we change

Port 7878

Save & Exit

Now restart sshd service using this command

# /etc/init.d/sshd restart

That’s All

Now reconnect with ssh

After Change ssh Port in Linux box, next time when you connect your machine via ssh you need to specify port no
with ssh command, in my cause it will be.

 ssh vm1.broexperts.com -p 7878

Now we are on lower security Risk……!

Watch Video Version of this HowTo

Similar Posts