Recursively fixing file and directory permissions
source link: https://www.devroom.io/2011/12/13/recursively-fixing-file-and-directory-permissions/?utm_campaign=Feed%3A+ariejan+%28ariejan%7Cdevroom.io%29
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Recursively fixing file and directory permissions
Posted:
2011-12-13
- Last updated:
2019-06-05
Tagged linux bash git sh file permissions
While working on a Gitlab installation I noticed that all repository file permissions were off. Fixing recursive file and directory permissions can be quite hard. Or so I thought.
Using the following commands (in plain Bash) allow you to recursively set permissions for files and directories. So, to fix the proper read permissions on your Gitlab repositories you can use this:
# Go to your git repositories directory (as git or the gitlab user)
cd /home/git/repositories
# Fix ownership
sudo chown -R git:git *
# Fix directory permissions
sudo find -type d -exec chmod 770 {} \;
# Fix file permissions
sudo find -type f -exec chmod 660 {} \;
After this, your Gitlab should have no trouble accessing your code (e.g. in the tree browser).
My site is free of ads and trackers. I record privacy-respecting usage statistics with Fathom.
Was this post helpful to you? Why not ☕ Buy me a coffee
Copyright © 1999-2020 Ariejan de Vroom <[email protected]>
Live now; make now always the most precious time. Now will never come again.
– Jean-Luc Picard
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK