SSH Alternative Port

From Computer Science Wiki
Revision as of 13:01, 3 August 2021 by Rhunter (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Setting up an Alternative port for SSH

Reason

Virginia Tech campus blocks certain ports at the network border to the rest of the internet.

Alternatives

Besides using a different port for SSH, you could also do one of the following:

Use the VT VPN.  Most VT's users have VPN access if they have set it up.
  https://onecampus.vt.edu/task/all/installing-pulse-vpn
If the server is well established (more than just a lab server or desktop) you can request a port 22 exception from Virginia Tech.  In order to do that contact techstaff@cs.vt.edu

Setup Alternative SSH Port

We recommend adding an additional port vs replacing another port for 22. In your /etc/ssh/sshd_config modify the following line:

#Port 22

with this:

Port 22
Port 2222

Then Restart the sshd service:

sudo service sshd restart

Open the ports on your firewall

Ubuntu

sudo ufw limit 22
sudo ufw limit 2222
sudo ufw enable #if you have not already done so#
sudo ufw status #verify the changes#

CentOS

sudo firewall-cmd --add-port=22/tcp --permanent  #May not be needed#
sudo firewall-cmd --add-port=2222/tcp --permanent
sudo service firewalld reload