How to open port 2222 in Linux?
Start by opening the /etc/ssh/sshd_config configuration file with nano or your preferred text editor. Look for the #Port 22 line. We'll need to uncomment this line and change the number to our desired port number. For this example, we'll switch the port number to 2222 .