3

OS: Kubuntu 16.04 LTS

I've managed to use KDE Connect successfully but I have a question about the ufw settings that are required to allow Kubuntu 16.04 to see my Android.

When I installed Kubuntu, one of the first things I did was to activate ufw and this is the terminal output:

sudo ufw status verbose
sudo password for dkbose:
Status: inactive
sudo ufw enable
Firewall is active and enabled on system startup
sudo ufw default deny
Default incoming policy changed to 'deny'
(be sure to update your rules accordingly)

Then, to use KDE Connect, I had to open certain ports as described in https://community.kde.org/KDEConnect:

sudo ufw allow 1714:1764/udp
sudo ufw allow 1714:1764/tcp
sudo ufw reload

My question is this: I will be using KDE Connect rather infrequently. So how can I reverse the opening of the ports each time I've finished using KDE Connect?

Based on what I read in https://help.ubuntu.com/community/UFW, is running

sudo ufw delete allow 1714:1764/udp
sudo ufw delete allow 1714:1764/tcp

the thing to do?

Do I also need to run

sudo ufw reload

to "update" ufw's rules?

I've seen https://askubuntu.com/a/410225/248158 but I'm not sure that answer is applicable to my question.

3

Yes, you can remove any rule by inserting delete into the command like you showed.
No, you don't need to reload ufw to apply rules - ufw is not a service, it "just" generates/saves/deletes proper iptables/ip6tables rules.

You can always check the results with

sudo iptables-save | grep 1714
sudo ip6tables-save | grep 1714

Btw: it might be a good idea to restrict the rules to devices on your local network (especially when you are not behind some sort of NAT-router/firewall), I also added a comment to the rules.

sudo ufw allow proto udp from 192.168.1.0/24 to any port 1714:1764 comment 'kdeconnect'
sudo ufw allow proto tcp from 192.168.1.0/24 to any port 1714:1764 comment 'kdeconnect'
sudo ufw allow proto udp from 2a02:xxxx:xxxx:xxxx::/64 to any port 1714:1764 comment 'kdeconnect'
sudo ufw allow proto tcp from 2a02:xxxx:xxxx:xxxx::/64 to any port 1714:1764 comment 'kdeconnect'

You would delete those rules with

sudo ufw delete allow proto udp from 192.168.1.0/24 to any port 1714:1764
sudo ufw delete allow proto tcp from 192.168.1.0/24 to any port 1714:1764
sudo ufw delete allow proto udp from 2a02:8389:187:7000::/64 to any port 1714:1764
sudo ufw delete allow proto tcp from 2a02:8389:187:7000::/64 to any port 1714:1764

(You can omit the comments)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.