On Dec 23, 2024, Timothy M Butterworth wrote:
> sudo fails with a permission denied error.
> tmb@hp-debian:~$ sudo /usr/sbin/iptables-save > /etc/iptables/rules.v4
> bash: /etc/iptables/rules.v4: Permission denied
"sudo" only modifies "iptables-save", and not the redirect (it happens
as your user, *before* the invocation of sudo, as I recall).
You'll need something like this, so that rules.v4 is opened as root
rather than your user:
sudo /usr/sbin/iptables-save | sudo tee /etc/iptables/rules.v4
--
|_|O|_|
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1 E067 6D65 70E5 4CE7 2860
Attachment:
signature.asc
Description: PGP signature