0

How can I allow a specific user on my Ubuntu desktop to view/open all folders and files in a specific location without affecting or changing the owner:group of that location?

Until now I need to legitimate me and I don't want this behavior. The location is a backup directory from rsync who need to preserve the owner:group.

Thanks in advance.

Omexlu
  • 43
  • 1
  • 9

1 Answers1

0

You can use ACLs. If you want in addition to existing owner:group permissions add a permission for user1 to browse folder folder1 and it's contents, use the command:

setfacl -m -R u:user1:rX folder1
raj
  • 542
  • 2
  • 8
  • If the content change is needed to run this command after all content change because it's recursive? And how to remove this permission if needed? – Omexlu Feb 09 '21 at 03:36
  • The command is recursive because you wanted to add access for all files and subfolders in `folder1`. If the content changes, you can run the command only for new files/folders (this time without the `-R` parameter), or rerun for the whole folder again. To remove the permission, use `-x` instead of `-m`. See `man setfacl` for more details. – raj Feb 09 '21 at 10:09
  • Thanks you, I rerun the command after all rsync backup trough my bashscript works fine :) – Omexlu Feb 09 '21 at 12:41
  • Before synchronisation from local-PC to server It might be better to remove setfacl completely from local-PC because it changes the files right, the extanted rights (+) are removed but the file rights are still with rX, so it might better to remove before syncing back to server? – Omexlu Feb 10 '21 at 07:46
  • Possibly yes, I never used it in that scenario, so you have to try. – raj Feb 10 '21 at 09:58
  • Yes it's needed, if I don't do that the rights on the server are not anymore as they should be, so it must be done do remove the setfacl before syncing back to server, thank you. – Omexlu Feb 10 '21 at 11:28