User Tools

Site Tools


more_ufw_commands_and_examples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
more_ufw_commands_and_examples [2016/07/24 20:20] walkeradminmore_ufw_commands_and_examples [2023/03/09 22:35] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== More UFW Commands and Examples ====== ====== More UFW Commands and Examples ======
 +\\ 
 +\\ 
 +Most of this information was acquired from //**https://www.linux.com/learn/introduction-uncomplicated-firewall-ufw**//
 \\  \\ 
 \\  \\ 
Line 10: Line 13:
 \\  \\ 
 NOTE: I added sudo to the command because you must have admin privileges to run ufw. If you’re using a distribution that doesn’t take advantage of sudo, you’d first have to su to root and then run the same command (minus sudo). NOTE: I added sudo to the command because you must have admin privileges to run ufw. If you’re using a distribution that doesn’t take advantage of sudo, you’d first have to su to root and then run the same command (minus sudo).
 +\\ 
 Conversely, say you want to prevent traffic on port 22. To do this, the command would look like: Conversely, say you want to prevent traffic on port 22. To do this, the command would look like:
-sudo ufw deny 22 +\\  
 +        sudo ufw deny 22 
 +\\ 
 Should you want to add a protocol to this, the command would look like: Should you want to add a protocol to this, the command would look like:
-sudo ufw deny 22/tcp +\\  
 +        sudo ufw deny 22/tcp 
 +\\ 
 What happens if you don’t happen to know the port number for a service? The developers have taken that into consideration. UFW will run against /etc/services in such a way that you can define a rule using a service instead of a port. To allow SSH traffic, that command would look like: What happens if you don’t happen to know the port number for a service? The developers have taken that into consideration. UFW will run against /etc/services in such a way that you can define a rule using a service instead of a port. To allow SSH traffic, that command would look like:
-sudo ufw allow ssh +\\  
 +        sudo ufw allow ssh 
 +\\ 
 Pretty simple, right? You can also add protocols to the above command, in the same way you did when defining a rule via port number. Pretty simple, right? You can also add protocols to the above command, in the same way you did when defining a rule via port number.
-sudo ufw allow ssh/tcp+\\  
 +        sudo ufw allow ssh/tcp 
 +\\  
 +\\ 
  
more_ufw_commands_and_examples.1469388016.txt.gz · Last modified: 2023/03/09 22:35 (external edit)