title: Change permissions of file in Ruby
body: <p>I have code as follows</p>
  
  <pre><code> def initialise
     @doc_path =nil
     @user= nil
  end
  def execute
     oscmd = Common::OsCmd.new
     oscmd.log = @log.info("message")
     File.open("#{@doc_path}/new.doc","w") do |f|
        f.puts "/#{@name}  /people/* "
        File.chmod(0777,"#{@doc_path}/new.doc")
        FileUtils.chown("#{@user}, #{@user}, #{@doc_path}")
     end
  end
  </code></pre>
  
  <p>So my code gets executed by tokenisation from other config file where it has values for <code>doc_path</code>, <code>user</code></p>
  
  <p>My code is giving error on <code>chown</code> and <code>chmod</code></p>