I'm trying to add the following commands to rc.local:
iptables -A OUTPUT -m owner --gid-owner vpnroute \! -o tun0 -j REJECT -g vpnroute transmission-gtk
This is to force transmission to only use my vpn and then launch it. Vpnroute group is present and lc.local is owned by root and can be executed. Have also tried to start via lxsessions startup manager with no luck. I've also tried to make a script, chmod it and call it from rc.local.
The script itself can be run without problems from terminal, however nothing happens at startup. Then I tried to make a .desktop file to execute the script, put it in /home/username/.config/autostart, didn't work either.
>> /var/log/rc.local.log 2>&1 but there is no log created after startup. If I run rc.local manually I get a log that says
/etc/rc.local: 15:/etc/rc.local:-g: not found.
If I add sudo to the commands, rc.local executes manually(with password), still not on boot though.
My rc.local: #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. sleep 5 sudo iptables -A OUTPUT -m owner --gid-owner vpnroute \! -o tun0 -j REJECT >> /var/log/rc.local.log 2>&1 sudo -g vpnroute transmission-gtk >> /var/log/rc.local.log 2>&1 exit 0
And the script version, when trying to start it that way:
#!/bin/bash sleep 3 sudo iptables -A OUTPUT -m owner --gid-owner vpnroute \! -o tun0 -j REJECT sudo -g vpnroute transmission-gtk exit
I've changed them both so many times now, to try different suggestions from online forums.
Any help would be greatly appreciated! Best regards Alex