![]() ![]() Restart the SSH service to apply the changes: sudo systemctl restart ssh Step 7: Verify the Configuration Then, add a new rule for the custom SSH port: sudo ufw allow 33556/tcp Step 6: Restart the SSH Service First, delete the previous SSH rule: sudo ufw delete allow ssh Update the firewall rules to allow inbound connections on the custom SSH port. Step 5: Configure Firewall Rules for the Custom SSH Port Remove the # at the beginning of the line to uncomment it. Next, open the SSH configuration file using a text editor like nano: sudo nano /etc/ssh/sshd_configįind the line that starts with #Port 22 and change it to the desired port number. You can choose a different port number if you prefer, but make sure it's not already in use by another service.įirst, create a backup of the original SSH configuration file: sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak In this example, we'll change the default SSH port from 22 to 33556. ![]() Next, allow inbound SSH connections by adding a new firewall rule: sudo ufw allow ssh Step 4: Change the Default SSH Port If UFW is inactive, enable it with the following command: sudo ufw enable First, check the status of UFW by running: sudo ufw status Run the following command in the terminal window: sudo apt install openssh-server Step 3: Configure Firewall Rules for SSHīy default, Ubuntu comes with the Uncomplicated Firewall (UFW) to manage firewall rules. To enable SSH on your Ubuntu system, you'll need to install the OpenSSH server. Sudo apt upgrade Step 2: Install the OpenSSH Server Open a terminal window and run the following commands: sudo apt update
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |