title: How to edit a *nix system file using Ruby's File.open command?
body: <p>In my CMS (Rails 4), I need to let a user make CRUD processes on CIFS mount points. In order to have a permanent CIFS mount on a CentOS (6) system, I need to edit the <code>/etc/fstab</code> file and update the mount list with the <code>sudo mount -a</code> command. When I try to open <code>/etc/fstab</code> file with <code>File.open</code>:</p>
  
  <pre><code>File.open("/etc/fstab", "a") do |f|
    f.puts "\n test"
  end
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Errno::EACCES: Permission denied - /etc/fstab
  </code></pre>
  
  <p>It's normal because <code>/etc/fstab</code> file belongs to the root user. Is there a way to open a file as super user? At the other hand, I'm open to different ideas. My requirement is to edit the fstab file from inside of my application.</p>