Skip to content

Instantly share code, notes, and snippets.

@badhonhitech
Last active May 5, 2020 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badhonhitech/bc2444e977dfc311076eca8f6cdb8441 to your computer and use it in GitHub Desktop.
Save badhonhitech/bc2444e977dfc311076eca8f6cdb8441 to your computer and use it in GitHub Desktop.
Working With Ubuntu Firewall
1.Enable Disable firewall on Ubuntu 18.04
Check a current firewall status
$ sudo ufw status
Enable Firewall
$ sudo ufw enable
Disable Firewall
$ sudo ufw disable
$ sudo ufw status
2.How to Enable SSH on Ubuntu 18.04
Secure Shell (SSH) is a cryptographic network protocol used for a secure connection between a client and a server.
In this tutorial, we’ll show you how to enable SSH on an Ubuntu Desktop machine. Enabling SSH will allow you to remotely connect to your Ubuntu machine and securely transfer files or perform administrative tasks.
Enabling SSH on Ubuntu
sudo apt update
sudo apt install openssh-server
sudo systemctl status ssh
sudo ufw allow ssh
sudo systemctl stop ssh
To start it again run:
sudo systemctl start ssh
To disable the SSH service to start during system boot run:
sudo systemctl disable ssh
To enable it again type:
sudo systemctl start ssh
sudo systemctl stop ssh
sudo systemctl restart ssh
sudo systemctl enable ssh
sudo systemctl status ssh
3. open 443 port on ubuntu 18.04
$ sudo ufw allow 80
$ sudo ufw allow 443
OR
$ sudo ufw allow http
$ sudo ufw allow https
$ sudo ufw delete allow 80
$ sudo ufw delete allow 443
OR
$ sudo ufw delete allow http
$ sudo ufw delete allow https
4.Allow incoming connection on terminal
sudo ufw allow ssh
Allow Specific incoming connection
sudo ufw allow http
sudo ufw allow https
The following command allows connections from ports 6000 to 6003 for both tcp and udp.
sudo ufw allow 6000:6003/tcp
sudo ufw allow 6000:6003/udp
Enable UFW
sudo ufw enable
check status of ufw
sudo ufw status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment