Skip to content

Permissions Data Drives

Guillaume Boudreau edited this page Feb 3, 2024 · 11 revisions

Files disappearing or becoming unavailable from your shares a few seconds after being created?

Or you create files in your shares, and other users don't see them, even after you checked the permissions of the shared folders?
Your issue is most probably the permissions of your storage pool drives (folders).


First: This behaviour could be caused by missing wide links = yes and unix extensions = no Samba config options in the [global] section of /etc/samba/smb.conf. This might be a quick fix, so check this first.
See the USAGE file for details.

If that is not the problem, continue below.


Greyhole works by moving the files you add to your shares onto other drives or folders. Thus, once Greyhole move the file and leave behind a symlink in your shared folder, if your users don't have the permissions required to access the file that is now on another drive, they will be able to read the symlink, but not its target, and thus the file will be hidden by Samba.

Login as a problematic user (using SSH; use sudo if needed), and go look at a symlink in shared folder (the path specified in smb.conf) that this user doesn't see on the share.
Look at the target of that symlink, and try to access that file. You'll most probably find that you can't. You probably need to chown/chmod -R all your storage pool drives to the same permissions & ownership as your shared folders.

Example:

$ egrep "path|^\[" /etc/samba/smb.conf
[Backups]
	path = /mnt/hdd2/shares/Backups
$ ls -la /mnt/hdd2/shares/Backups
drwxrwsr-x 22 gb   users     4096 Sep  4 11:57 .
[...]
$ grep storage_pool_drive /etc/greyhole.conf
	storage_pool_drive = /mnt/hdd1/gh, min_free: 10gb
	storage_pool_drive = /mnt/hdd2/gh, min_free: 10gb
$ ls -l /mnt/hdd[1-2]/gh
/mnt/hdd1/gh:
drwxrwsr-x  15 gb   users   4096 Jun 20 19:01 Backups
/mnt/hdd2/gh:
drwxrwsr-x  28 root   root    4096 Sep  2 04:30 Backups

Problem: the folder /mnt/hdd2/gh/Backups is owned by root:root instead of gb:users, as it should be (ie. same as the shared folder /mnt/hdd2/shares/Backups.
Fix it like this:

$ chown -R gb:users /mnt/hdd2/gh/Backups

Another issue you might face is Permission Denied errors, if the root folder of your drive is not readable:

gb@fileserver3:/mnt $ ls -la /mnt/hdd4/
drwx------  3 root root   15 Sep 13  2017 .
...

Fix it by making the root folders of your data drivers readable by all:

chmod 755 /mnt/hdd*

If fact, you most-probably want all your storage pool drives folder to have the same ownership and permissions:

$ chown -R gb:users /mnt/hdd* # Change gb:users to your username & primary group
$ find /mnt/hdd* -type d -exec chmod 775 "{}" \; # Change 775 to your prefered permissions for folders
$ find /mnt/hdd* -type f -exec chmod 664 "{}" \; # Change 664 to your prefered permissions for files