title: how to get linux username in a python program
body: <p>I'm using a program named ajenti on linux. it's a program to manage linux servers and it's written in python.</p>
  
  <p>I need to get linux username of logged in user for different sections like file manager. it is required to restrict user's access.</p>
  
  <p>the source of that software can be found <a href="https://github.com/ajenti/ajenti" rel="nofollow">here</a>, and for example in line 73 of <a href="https://github.com/ajenti/ajenti/blob/1.x/ajenti/plugins/fm/fm.py" rel="nofollow">file manager</a> the access can be defined. however I'm getting username by functions like "os.path.expanduser" or "pwd.getpwuid(os.getuid()).pw_name" now, it only returns "root" regardless of the logged in user.</p>
  
  <p>I want each username, what should I do?</p>
  
  <p>P.S: This is not a duplicate. I know there has been questions like mine but that's not exactly what I want. there is a slight difference between them.</p>