in reply to Re^4: Best way to write to a file owned by root?
in thread Best way to write to a file owned by root?
Thanks for the good info. This is interesting to think about. Fortunately, I'm just writing a script under my total control on my own local machine and does not have processes available to the public. Basically, it's just automating a task that I would do manually with sudo vim /etc/hosts command anyway. I'm trying to figure out how to do that with the least risk of breaking something. I *think* my code accomplished that because it makes a copy of the /etc/hosts file, makes the ownership and privileges changes to copy of the file and, if those are successful, only then copies the modified file back to /etc/hosts. Also, the file is read only only by my account so no one else can look at it.
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Best way to write to a file owned by root?
by afoken (Chancellor) on Mar 15, 2017 at 06:42 UTC | |
by nysus (Parson) on Mar 15, 2017 at 14:09 UTC | |
by hippo (Archbishop) on Mar 15, 2017 at 14:52 UTC | |
by nysus (Parson) on Mar 15, 2017 at 15:23 UTC | |
by afoken (Chancellor) on Mar 15, 2017 at 22:48 UTC | |
| |
by Anonymous Monk on Mar 15, 2017 at 15:46 UTC | |
|