× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

ReadyNAS102 - protection of truecrypt-file against delete

merlinux16
Aspirant

ReadyNAS102 - protection of truecrypt-file against delete

All my data on RN102 are saved in one truecrypt-file -"truecrypt_dad"- created on a laptop (OS Debian 8). This means that the RN102 manages only one file -"truecrypt_dad"-.

With the below described permission structure both users "dad" and "mom" can read and write the file "truecrypt_dad" from the laptop (OS Debian 8).

I want to protect the file "truecrypt_dad" against delete from user "mom", but I cannot find a solution.

MY PROBLEM: The user "mom", by attempting to delete "truecrypt_dad" does receive an errore message - "permission denied - you have not sufficient permissions to move the file into the trash" (free translated from german) - which is OK for me. But on the same window the button "DELETE" is still active and the user "mom" can delete the file!. To complete the confusion the user "mom" cannot rename the file due to insufficient permissions, which is also OK for me.

On one side the user "mom" cannot rename (OK for me) and cannot move into trash (OK for me), but on the other side can delete (not OK for me) the file.

I want to protect the file "truecrypt_dad" against delete from user "mom". There is a solution and an explanation for the strange behaviour mentioned above?

Thank you.

 

Technical data

Laptop description: OS Debain 8

extract from /etc/fstab of user "dad"

#nas

//IP/dad/ /media/dad cifs users,noauto,username=dad,passwd=dad 0 0

 

extract from /etc/fstab of user "mom"

#nas

//IP/dad/ /media/dad cifs users,noauto,username=mom,passwd=mom 0 0

 

NAS description: ReadyNAS102, Firmware 6.6.0, 2x 2TB

Configuration after factory reset:

SSH: activated

USERS/GROUPS

User     Group    comment

admin    admin    default user

dad        parents

mom      parents

 

SHARES

file/directory                    owner  group    permissions   comment

/data                                 root   root     drwxr-xr-x    default share; default permissions

 

/data/dad                          dad    parents  drwxrwx--T+   ACLs and Sticky-bit created by RN102; ALSs: rwx for admin

/data/dad/truecrypt_dad  dad    parents  -rwxrwx---+   file created with tuecrypt on laptop

Model: RN102|ReadyNAS 100 Series
Message 1 of 8
StephenB
Guru

Re: ReadyNAS102 - protection of truecrypt-file against delete

Try changing the permissions on the dad directory so that the group doesn't have write permission.

Message 2 of 8
merlinux16
Aspirant

Re: ReadyNAS102 - protection of truecrypt-file against delete

Thank you for your reply.

 

Both users "dad" and "mom" shall access to the file "truecrypt_dad". Only the user "dad" shall have the permission to delete "truecrypt_dad".

 

The question is: why is the user "mom" allowed to delete the "truecrypt_dad" if there are no permissions to rename it and move it into trash? Why is "DELETE" still active? I cannot understand this behavior.

 

If "DELETE" would not be active than everything would be fine for me.

 

 

Message 3 of 8
StephenB
Guru

Re: ReadyNAS102 - protection of truecrypt-file against delete


@merlinux16 wrote:

Why is "DELETE" still active? I cannot understand this behavior.

  


Linux doesn't have a separate "delete" permission. Deleting a file is done by modifying the folder the file is in.  If you give someone write permission to that folder, then you are giving them permission to delete the files in it.

 

You are allowing mom the ability to write to /data/dad (since anyone in the parents group has that permission).

Message 4 of 8
merlinux16
Aspirant

Re: ReadyNAS102 - protection of truecrypt-file against delete

Thank you for your reply. I modified the permission structure of folder "dad" as suggested by you and eliminated the write permission for group parents. Now /data/dad has "drwxr-x--T+" instead of "drwxrwx--T+". Owner and group are "dad" and "parents" as before. Unfortunately the user "mom" has still the possibility to delete all files! The only change is that (obviously) no new files can be created by "mom". The only possibility to avoid that the group "parents" delete something in /data/dad is to set "read only" in the window "network access" of share "dad" on the NAS-web-administration-surface. But in this way the user "mom" cannot work anymore with file "truecrypt_dad". I have the impression that the settings in "network access" of each NAS share have the right of way compared to the standard Linux permissions. According my understanding the NAS-system is given write permissions to the group parent in the folder "dad", even if the permissions structure is modified into "drwxr-x--T+". Do you see any possibility to solve my question? Thank you in advance for your support.
Message 5 of 8
StephenB
Guru

Re: ReadyNAS102 - protection of truecrypt-file against delete

You should be able to make the share read-only for mom (or perhaps "everyone") and read/write for dad via the network settings for the share.  That should block mom's ability to delete the file.  It should also prevent mom from writing to the file.

Message 6 of 8
merlinux16
Aspirant

Re: ReadyNAS102 - protection of truecrypt-file against delete

I'm able to make the share read-only for mom and read write for dad via the network settings for the share. This is not the problem. But I want that mom can write but cannot delete. This is a typical requirement for workgroups and not only an idea of mine. In a normal Linux system this is made with the sticky bit. If the stick bit is set on a directory, than only the owner can delete the files inside, even if the group has write permissions.

The NAS system has set automatically the sticky bit to /data/dad, this is the "T" in the permissions "drwxrwx--T+". But it works only partly, because as described in the first post, the user mom can write but cannot rename and cannot move the file into trash. I wrote also that the user mom get an error message by attempting to rename and to delete, even if mom has read write permissions via the network settings for the share. It means that the sticky bit is working, but not completely. For a reason which is not clear to me in the same error message the button delete is active and mom can delete. The sticky bit works only partly and I don't understand why. Only the network settings for the share have an influence on button delete. On the NAS is only network SMB activated. Is it samba? Do the network settings change the samba-permissions? Is it possible to activate the sticky bit via samba-permissions?

 

Thanks again for your support

Message 7 of 8
StephenB
Guru

Re: ReadyNAS102 - protection of truecrypt-file against delete


@merlinux16 wrote:

I'm able to make the share read-only for mom and read write for dad via the network settings for the share. This is not the problem. But I want that mom can write but cannot delete. This is a typical requirement for workgroups and not only an idea of mine. In a normal Linux system this is made with the sticky bit. If the stick bit is set on a directory, than only the owner can delete the files inside, even if the group has write permissions.


Is "grant rename and delete" checked on the file access tab?  Though it says "NFS and AFP" you should probably still uncheck it.

 

If that doesn't work you might need to look at (and modify) the acl for the share from ssh.  You could also try putting the file inside of a subfolder, and set the sticky bit there.  The share itself is a btrfs subvolume, and might behave a bit differently from a normal folder.

Message 8 of 8
Top Contributors
Discussion stats
  • 7 replies
  • 3729 views
  • 0 kudos
  • 2 in conversation
Announcements