title: How do I run uWSGI as a limited-access user?
body: <p>I have Django setup in NGINX + uWSGI. I'm able to get it running fine under my current logged in user (with help from a <a href="https://stackoverflow.com/questions/35400393/nginxuwsgidjango-permission-denied-while-connecting-to-upstream-socket" title="question">question</a> I asked few days back) but now I want to <strong>run <code>uwsgi --ini uwsgi.ini</code> as a limited-access user</strong>. </p>
  
  <p>Here is what I've done so far:<br>
  1. Created a user <code>djangouser</code> without login access and without a home directory. <br>
  2. Added user <code>nginx</code> into group <code>djangouser</code><br>
  3. Placed my django files into <code>/mnt/django</code> directory and changed file permissions of <code>django</code> to <code>drwxrwx--- djangouser djangouser</code> (recursive) <br>
  4. Changed the conf files to match the file locations<br><br>
  uwsgi.ini file</p>
  
  <pre><code>[uwsgi]
  chdir=/mnt/django/project/awssite
  module=awssite.wsgi
  home=/mnt/django/project
  master=true
  processes=2
  uid=djangouser
  gid=djangouser
  socket=/mnt/django/djangosocket/awssite.socket
  chmod-socket
  vacuum=true
  </code></pre>
  
  <p>When I try to run <code>uwsgi --ini uwsgi.ini</code>, this is the error I get</p>
  
  <pre><code>[uWSGI] getting INI configuration from uwsgi.ini
  *** Starting uWSGI 2.0.12 (64bit) on [Thu Feb 18 00:18:25 2016] ***
  compiled with version: 4.8.3 20140911 (Red Hat 4.8.3-9) on 01 February 2016 04:17:11
  os: Linux-4.1.13-19.31.amzn1.x86_64 #1 SMP Wed Jan 20 00:25:47 UTC 2016
  nodename: ip-10-200-1-89
  machine: x86_64
  clock source: unix
  detected number of CPU cores: 1
  current working directory: /home/ec2-user
  detected binary path: /usr/local/bin/uwsgi
  !!! no internal routing support, rebuild with pcre support !!!
  chdir() to /mnt/django/project/awssite
  chdir(): Permission denied [core/uwsgi.c line 2586]
  chdir(): Permission denied [core/uwsgi.c line 1608]
  </code></pre>
  
  <p><strong>Note</strong>: When I added my logged in user to <code>djangouser</code> group, <code>uwsgi --ini uwsgi.ini</code> ran fine and I was able to load the django pages.</p>
  
  <p>I'm not sure where else to add permissions to allow this to work. Adding <code>sudo chown-socket=djangouser:djangouser</code> in uwsgi.ini didn't work either. </p>
  
  <p>I appreciate the help :)</p>