SSH Alternative Port: Difference between revisions

From Computer Science Wiki
Jump to navigation Jump to search
(Created page with "== 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 ===...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
=== Alternatives ===
=== Alternatives ===
Besides using a different port for SSH, you could also do one of the following:
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.
  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
  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 reqeuest a port 22 exception from Virginia Tech.  In order to do that contact techstaff@cs.vt.edu
 
  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 ==
== Setup Alternative SSH Port ==
Line 16: Line 17:
  Port 22
  Port 22
  Port 2222
  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

Latest revision as of 13:01, 3 August 2021

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