Hurtling through Space

Copy Permissions

05 December 2017

If you’re lazy about permissions, chmod and chown both take a --reference flag to set permissions equal to those of another file.

chmod --reference=file/with/good/permissions file/with/permissions/to/fix

This comes up for us in a Rails app that we generally run in a Docker container. When we bin/rake generate migration, the new migration file is owned by root, which is annoying. A better next step might be to stop running the app inside a container in dev, but that’s a different piece of work altogether.

More usefulness about chown and chmod flags here.


All writings and opinions are my own and not the views of my employer.
All Rights Reserved, except for the parts enumerated below: