0

I'm trying the following :

sudo iptables-save > /etc/iptables/Firewall.rules

but I get permission denied: Firewall.rules even if ls -l tells me that root has writing permission for this file :

-rw-r--r-- 1 root root  362 Aug  3 14:26 Firewall.rules

Is it normal?

When I run su and then directly try this redirection as superuser (without sudo), I have no problem.

Even if I'm not sure, my guess is that sudo only applies on the iptables-save command and not on the > redirection (sudo(iptables-save) > file instead of sudo(iptables-save > file) if I had to express the priorities with parenthesis and pseudo code).

If I'm right about this, how could I apply sudo to my whole command line?

If I'm wrong, what did I miss?

vmonteco
  • 14,136
  • 15
  • 55
  • 86
  • 1
    See http://stackoverflow.com/questions/82256/how-do-i-use-sudo-to-redirect-output-to-a-location-i-dont-have-permission. Hopefully this will help. – Vikas Jindal Sep 08 '16 at 13:30
  • It does, my bad I didn't find this result. I'll mark my post as duplicate. Thank you for your help! – vmonteco Sep 08 '16 at 13:33

0 Answers0