I have a droplet hosted in Digital Ocean runing Ubuntu 14.04.

I have a gunicorn log directory I made to store my logfiles and it only works if the owner is the user which is running the gunicorn process.

I do...

chown user gunicorn

but that only lasts until a reboot and then the ownership goes back to root and the group is adm. I am running a django process and I am not sure what to do. How can I make my change to a new owner permanent or would adding the user to the group adm work as well?

directory path is...


ls -la the gunicorn directory...

drwxr-x---  2 root   adm        4096 Jan 30 20:08 .
drwxrwxr-x 12 root   syslog     4096 Jan 31 03:06 ..
-rw-r--r--  1 django django    73747 Jan 31 02:34 access.log
-rw-r--r--  1 django django 97698592 Jan 31 03:05 error.log

mount output..

/dev/vda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)

ls -la /var/log | grep gunicorn...

drwxr-x---  2 root      adm           4096 Jan 30 20:08 gunicorn


description "Gunicorn daemon for Django project"

start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!12345]

# If the process quits unexpectadly trigger a respawn

setuid django
setgid django
chdir /home/django

exec venv/bin/gunicorn \
    --name=langalang \
    --pythonpath=langalang \
    --bind= \
    --config /etc/gunicorn.d/gunicorn.py \


"""gunicorn WSGI server configuration."""
from multiprocessing import cpu_count
from os import environ

def max_workers():
    return cpu_count() * 2 + 1

max_requests = 1000
worker_class = 'gevent'
workers = max_workers()
errorlog = '/var/log/gunicorn/error.log'
accesslog = '/var/log/gunicorn/access.log'
  • What init system is your Linux using (systemd, Upstart, sysvinit)? You can also run the chown command from /etc/rc.local, that happens so late in the boot process, that the culprit probably already has broken things by chang ownership back to root. – Anthon Jan 31 '16 at 7:36
  • it ususes upstart I believe, it is Ubuntu14.04 – deltaskelta Jan 31 '16 at 7:37
  • Please add the directory full path to the post. – Rui F Ribeiro Jan 31 '16 at 7:55
  • added. @RuiFRibeiro – deltaskelta Jan 31 '16 at 7:58
  • hmmm...I though you might be using /run...ls -la /var/log/gunicorn and the output of mount? – Rui F Ribeiro Jan 31 '16 at 8:02

It turns out there was a script at /etc/init.d/gunicorn that was creating and giving the directory permissions everytime gunicorn started. I just changed the permissions in that file and everything works ok. That was really hard to find

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.