in reply to Best way to write to a file owned by root?

I'm using the Config::Hosts to make updates to the /etc/hosts file. My script runs under my regular user account and so it is unable to write to the /etc/hosts which is owned by root.

Just a few extra notes:

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: Best way to write to a file owned by root?
by Corion (Patriarch) on Mar 14, 2017 at 07:48 UTC

    On my computers, I use /etc/hosts as a first line ad-blocker. For that, it works quite well, especially on my phone.