Hurtling through Space

Copy Permissions

05 December 2017
Show BibTeX citation

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.


How to cite this blog post:

@misc{Pittman201712C,
    author = {Pittman, Cameron},
    title = {Copy permissions},
    journal = {Hurtling through Space},
    url = {},
    year = {2017},
    month = {December},
    accessed = {Oct 17, 2022}
}
All writings and opinions are my own and not the views of my employer.
All Rights Reserved, except for the parts enumerated below: