Rails file system permissions

I previous used a rake command to do some file system updates which I used this command to open my /public foder.

- command: chown nginx:app_writers $STACK_PATH/public && chmod 775 $STACK_PATH/public
run_on: all_servers
target: rails
sudo: true

Is there a user(we can grant access to) to allow rails to write to /public in a similar fashion? I’m using sidekiq / workers to update a sitemap and need to be able to write to /public inside the worker.

On AWS, your workers run under the “ubuntu” user, which is part of the app_writers group. As such, the permissions you’ve set should be enough to give that user access to the /public folder.

Could you please try it with this command?

chown nginx:app_writers $STACK_PATH/FOLDER && chmod 775 $STACK_PATH/FOLDER && sudo chmod g+s $STACK_PATH/FOLDER

I added the sticky bit to the end, so that any new files created will retain the same permissions for the group. Let me know how that goes!

That did it!

You must be logged in to answer this question