0

I have a web application running on Ubuntu 14.04. The app's deployment service creates separate users, groups and permissions automatically when deploying the app to my server on AWS.

The app runs as a user called nginx which is part of a group also called nginx. When I ssh in I must do so as another user: michaelmichael. I am not part of the nginx group.

The app has a /tmp/cache dir that I must be able to write to as the michaelmichael user in order to manually initialize some settings. When I attempt to do so, I get a 'permission denied' error.

My next step is to check the permissions for the folder. Things start to get confusing. The directory is symlinked so that it can refer to multiple iterations of the application. So, for example, the actual directory that I try to write to is /var/deploy/my-app/web_head/releases/20150221204050/tmp/cache If I ls -l on this directory I get the following:

lrwxrwxrwx 1 nginx nginx 43 Feb 21 20:40 /var/deploy/my-app/web_head/releases/20150221204050/tmp/cache -> /var/deploy/my-app/web_head/shared/cache

If I ls -l /var/deploy/my-app/web_head/shared I can see that cache is a directory with the following permissions:

drwxrwxr-x 14 nginx nginx 4096 Feb 21 20:31 cache

So, in order to write to this directory, do I need to add my user, michaelmichael to the nginx group? Do I need to modify the permissions of the symlinked directory (the /releases/ dir), or the directory itself (the cache dir)?

1

The obvious answer is sometimes the correct one.  You need to write to the cache directory, so you need write permission to the cache directory.  The fact that you're able to do the ls -l demonstrates that you have all the necessary access to the releases directory.

You can get the desired access by either adding your user to the nginx group or changing the mode of the cache directory (probably to 777).

  • Yep. Don't know why it wasn't more obvious to me. Easy points! – michaelmichael Feb 21 '15 at 21:52

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.