title: Is this possible to switch the user and group of an application thread?
body: <p>I want to build a small web application in Rust which should be able to read and write files on a users behalf. The user should authenticate with their UNIX credentials and then be able to read / write only the files they have access to.</p>
  
  <p>My first idea, which would also seem the most secure to me, would be to switch the user-context of an application thread and do all the read/write-stuff there. Is this possible?</p>
  
  <p>If this is possible, what would the performance look like? I would assume spawning an operating system thread every time a request comes in could have a very high overhead. Is there a better way to do this?</p>
  
  <p>I really wouldn't like to run my entire application as root and check the permissions manually.</p>