Score:0

How can I make a UFW rule specific to my home wifi network without changing profiles?

za flag

Is there any way to make a UFW rule specific to only one wifi network without having to change profiles? I want to be able to keep ports open for SSH and SAMBA on my computer while it is connected to my home wifi network (which has its own firewall), but have them closed whenever the computer is connected to any other network (i.e. Starbucks).

Right now, I do this manually by switching between "Home" and "Work" profiles in the GUI, but I've forgotten to do that more than once, so I'm trying to take my forgetfulness out of the equation.

in flag
Silly question, but your Samba and SSH config requires authentication to connect, yes?
James D. avatar
za flag
Yes, but an open port on a public network is still a problem.
Score:1
in flag

You can configure UFW to allow (or deny) traffic to specific interfaces, but not networks. If it’s possible to use a wired connection at home and WiFi when out and about, then you can do something like this:

sudo ufw deny ssh on wlan0
sudo ufw deny samba on wlan0

Note: Be sure to change wlan0 to the actual interface where you want to block Samba and SSH.

Alternatively, it would be possible to write a script that disables SSH and Samba every time your system sleeps and/or shuts down, meaning you would have to remember to start the OpenSSH or Samba service manually before using it.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.