You get a bonus - 1 coin for daily activity. Now you have 1 coin

How to Change the SSH Port Number (Daemon or Server) in Linux or FreeBSD

Practice



Task: change the port number in Unix, whether Linux (Debian, CentOS, Ubuntu, RedHat) or FreeBSD.


Solution: go to /etc/ssh:

$ cd /etc/ssh

And open the sshd_config file for editing.

Now find the following option inside it:

Port 22

and change the port number to the one you need. Then save the file and exit the editor.

Now restart the SSH daemon.


Linux (Debian/Ubuntu):

$ sudo /etc/init.d/ssh restart


Linux (CentOS/RHEL):

$ sudo /etc/init.d/sshd restart


FreeBSD:

$ sudo /etc/rc.d/sshd restart

That's it... don't forget to allow the new port through the firewall!

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "LINUX operating system"

Terms: LINUX operating system