Forrest logo
back to the ufw tool

ufw:tldr:2f459

ufw: Allow only TCP traffic from 192.168.0.4 to any address on this host, on port 22.
$ ufw allow proto ${tcp} from ${192-168-0-4} to ${any} port ${22}
try on your machine

This command is used for configuring the Uncomplicated Firewall (UFW) to allow incoming TCP traffic from a specific source IP address (192.168.0.4) to any destination IP address on port 22.

Let's break down the command:

  • ufw allow: This is the UFW command to add a new rule to allow incoming traffic.
  • proto ${tcp}: This specifies the protocol to be allowed, which in this case is TCP.
  • from ${192-168-0-4}: This specifies the source IP address from which the incoming traffic is allowed. In this case, it is set to 192.168.0.4. You would normally replace ${192-168-0-4} with the actual IP address.
  • to ${any}: This specifies the destination IP address. When set to ${any}, it means that the incoming traffic can be destined to any IP address. Again, you might replace ${any} with a specific IP address if desired.
  • port ${22}: This specifies the destination port number. In this case, it is set to port 22, which is typically used for SSH (Secure Shell) access. Replace ${22} with a different port number if needed.

By running this command, you are allowing TCP traffic from the specified source IP address to any destination IP address on port 22.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ufw tool