Fixing UNIX Permissions

Recently, because of a long due migration from Windows file servers and separate Linux file servers to a single multi-drive-bay server chassis running multiple FreeBSD VMs we had to deal with a bunch of permission issues. The best way to solve these was to run the following commands:

find . -type d -not -path "./.snap" -exec chmod 775 {} \;
find . -type f -not -path "./.snap/*" -exec chmod 664 {} \;

These take care to ignore the .snap snapshot directory that's created by FreeBSD, otherwise, you'll have issues down the line.

Also, if you want to ensure that the entire filesystem respects the default layout for shared files where directories are 775 and files are 664. If you also require a change in owner or group you can also run the following commands:

find . -type d -not -path "./.snap" -exec chown nathanpc:staff {} \;
find . -type f -not -path "./.snap/*" -exec chown nathanpc:staff {} \;

Common Conventions

It's important that if you're going to be creating any NFS shares to maintain a consistent set of permissions to ensure the biggest platform compatibility possible. In order to do this make sure that the user's default group in the server is set to staff (GID 20), since this will always work on all of the BSDs, macOS, and most likely most Linux distributions.

notes/fix-unix-perms.txt · Last modified: by nathanpc
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki