Changing the port sshd runs on from port 22 to another port is really simple. You just need to update the /etc/sshd/sshd_config file to specify an alternate port.
# cat /etc/sshd/sshd_config
# This is ssh server systemwide configuration file.
Port 22
ListenAddress 192.168.1.1
HostKey /etc/ssh/ssh_host_key
ServerKeyBits 1024
LoginGraceTime 600
KeyRegenerationInterval 3600
PermitRootLogin no
IgnoreRhosts yes
IgnoreUserKnownHosts yes
StrictModes yes
X11Forwarding no
PrintMotd yes
SyslogFacility AUTH
LogLevel INFO
RhostsAuthentication no
RhostsRSAAuthentication no
RSAAuthentication yes
PasswordAuthentication yes
PermitEmptyPasswords no
AllowUsers admin
To change the port, simply update “Port 22” with the new port number. Once your config file is saved, restart sshd and you should be all set.
Keep in mind that you’ll now need to use ssh -p