To enable SSH on a different port, the following steps are to be followed
1. Opening the target port on your VPS firewall : Your VPS comes with the APF firewall installed, so you will need to open up the port at the firewall
This can be done by editing the /etc/apf/conf.apf
and search for an entry within conf.apf as
IG_TCP_CPORTS
and add the intended port to this list
Save the state of the firewall and restart the service using the commands
apf -s
/etc/init.d/apf restart
2. Edit the file /etc/ssh/sshd_config
change the entry
Port 22
to the intended destination port where SSH should be listening.
3. Edit the file /etc/services
hash the entry
ssh 22/tcp #SSH Remote Login Protocol ssh 22/udp #SSH Remote Login Protocol
#ssh 22/tcp #SSH Remote Login Protocol #ssh 22/udp #SSH Remote Login Protocol
and place the entry at the destined port
ssh portnumber/tcp ssh portnumber/udp
Restart the SSH daemon using the command
~ /etc/init.d/sshd restart
You will be able to access SSH now using
ssh root@vps -p portnumber