# File lib/vagrant-lxc/driver.rb, line 274
      def write_config(contents)
        confpath = base_path.join('config').to_s
        begin
          File.open(confpath, File::RDWR) do |file|
            file.write contents
          end
        rescue
          # We don't have permissions to write in the conf file. That's probably because it's a
          # privileged container. Work around that through sudo_wrapper.
          Tempfile.new('lxc-config').tap do |file|
            file.chmod 0644
            file.write contents
            file.close
            @sudo_wrapper.run 'cp', '-f', file.path, confpath
            @sudo_wrapper.run 'chown', 'root:root', confpath
          end
        end
      end