title: Use sudo to change file in root directory
body: <p>I'm trying to write a script to configure <code>resolv.conf</code> and <code>/etc/network/interfaces</code> automatically. I'm running the commands as "sudo", but I'm getting "Permission denied" errors.</p>
  
  <pre><code>sudo apt-get --assume-yes install vsftpd
  sudo "nameserver 8.8.8.8" &gt;&gt; /etc/resolv.conf
  sudo python setinterfaces.py
  sudo chattr +i /etc/network/interfaces
  sudo apt-get --assume-yes install lamp-server^
  </code></pre>
  
  <p>Lines 2 and 3 get permission denied errors, but lines 1 and 5 did run. <code>setinterfaces.py</code> is supposed to overwrite <code>/etc/network/interfaces'.</code>setinterfaces.py<code>works when pointed at the home folder but not the</code>interfaces` file.</p>
  
  <p>Any idea? Do I have to be changing ownership? Ideally I'd like this to be a one command script, where I can just call it and it will run. I'm writing this script for people who are not experienced in *nix.</p>