Linux – Grant users ‘read only’ access to NFS share without affecting current permissions

file-permissionslinuxnfs

I have a Linux (Ubuntu 16.04) server that roughly 30 users login to with shell access. There are different groups setup which manages their access to folders within /opt/working/shared/.

/opt/working/shared is backed up daily to /opt/backup/working/shared, an NFS mounted share from a NAS. These get backed up with the same permissions as the original files, yet the users don't get access to /opt/backup. This keeps users from browsing the share, but allows restoring with the original permissions.

I've been asked to provide these users read-only access to the backup area. I'm wondering what the best way to approach this might be?

If I allow them access to /opt/backup as it stands, they will have write access to any file they have write access to in /opt/working/shared, but removing write access to these files will overwrite the original permissions and adding complexity to a restore.

Is there a nice way to perhaps provide read-only access to the backup directories for non sudo'd users, whilst still adhering to original group permissions? This would keep the original permission structure and not allow users to see other peoples files, yet stop users from overwriting their own backups. I feel there's a better way to manage this rather than amending the permissions but I may be wrong.

Best Answer

A minimal and trivial solution would be to mount the same NFS share a second time:

  • with the "ro" mount option to force read-only operations
  • on a location that your users can access

That way you don't have to change anything in how your existing backups are made, no complicated tricks with permissions etc.