title: how to impersonate in linux
body: <p>I have developed a multi-platform desktop application in python and PyQt and in it i want to implement the concept of impersonation. I have a requirement where user selects a file and the the application will check for naming conventions and other things. If everythin is fine then it copies the file in a server where only impersonate user lets say (user123) has full permissions other has only read permissions.</p>
  
  <p>I could able to achieve this in windows by using <code>win32security</code> and <code>win32con</code> </p>
  
  <p><strong>TO IMPERSONATE LOGIN</strong></p>
  
  <pre><code>Self.handel=win32security.LogonUser(self.loginID,self.domain,self.password,win32con.LOGON32_LOGON_INTERACTIVE,win32con.LOGON32_PROVIDER_DEFAULT)
  win32security.ImpersonateLoggedOnUser(self.handel)
  </code></pre>
  
  <p><strong>AND TO REVERT BACK TO USER</strong></p>
  
  <pre><code>win32security.RevertToSelf()
  </code></pre>
  
  <p>Can anyone suggest an approach to this under Linux (RHEL 6).</p>