To allow SFTP (which uses port 22, same as SSH) from a specific subnet using UFW, the most specific and correct syntax is:
bash
sudo ufw allow from 10.10.0.0/24 to any port 22
This allows traffic from a specific subnet to port 22, which is what’s required.
Option B allows traffic on an interface but is not limited to the subnet.
Option C is incomplete — it allows all ports from the subnet.
Option D is malformed syntax — 0:22/tcp is not a valid port range or UFW format.
[Reference: CompTIA Linux+ XK0-005 Official Study Guide, Domain 3.0 – Security, “UFW rules can be configured to restrict access by IP range and port. For SFTP, allow port 22 specifically from the required subnet.”, ]
Submit