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

Mimic "Set ownership and permission for ...." in cron?

gonzonia
Aspirant

Mimic "Set ownership and permission for ...." in cron?

I previously posted an issue I was having with Backup errors

 

https://community.netgear.com/t5/Using-your-ReadyNAS/Backup-FROM-ReadyNAS-NVX-to-OSX-with-NFS/m-p/10...

 

 

I find now that whenever I copy something over to the directory being backed up I need to manually go into Frontview and run the "Set ownership and permission for existing files and folders in this share to the above settings." to clear or prevent the error. 

 

The NAS is being used at home and there really aren't multiple users so I'm not concerned about having to do this and it causing problems for anyone else. However, I'd rather not have to do this manually. 

What command(s) are being run when I check that? Can I set up a cron job that runs the same command 30 min before the backup each night?

 

Thanks. 

 

Running RAIDiator 4.2.28

Model: ReadyNASRNDX400E|ReadyNAS NVX Pioneer Chassis only
Message 1 of 13

Accepted Solutions
StephenB
Guru

Re: Mimic "Set ownership and permission for ...." in cron?

If you run top and use the "c" toggle you can see that the commands are chown -R user:group /c/sharename and chmod -R xxx /c/sharename (xxx being determined by the permissions you set).

 

This still seems like the wrong solution to me.  Why not just create a matching group on the mac?  or reset the GID for staff?

View solution in original post

Message 10 of 13

All Replies
StephenB
Guru

Re: Mimic "Set ownership and permission for ...." in cron?

A simpler way is to set up NAS credentials in the windows credentials manager for each PC using the system.  You can use the same credentials in every PC (and it can be any NAS account, including admin).

 

Not sure what the OSX equivalent is - keychain?

Message 2 of 13
gonzonia
Aspirant

Re: Mimic "Set ownership and permission for ...." in cron?

I'll try connecting to the share as admin and see if that fixes the issue. Thanks. 

 

EDIT: Nope. Still get the error. 

Message 3 of 13
StephenB
Guru

Re: Mimic "Set ownership and permission for ...." in cron?


@gonzonia wrote:

I'll try connecting to the share as admin and see if that fixes the issue. Thanks. 

 

EDIT: Nope. Still get the error. 


Is the share owned by admin?  Do you have guest access enabled?

 

Also, are you using smb/cifs or afp???

Message 4 of 13
gonzonia
Aspirant

Re: Mimic "Set ownership and permission for ...." in cron?


@StephenB wrote:


Is the share owned by admin?  Do you have guest access enabled?

 

Also, are you using smb/cifs or afp???


Using AFP to connect. Guest access is enabled. Also have checked "Automatically set permissions on new files and folders.". Everything is Read/Write. 

 

Owner is the user I was previously using to login. 

Group is currently set to the group that matches the GID on the machine the backup copies to. 

 

Maybe it's because even though Owner is a member of the Gods group, they aren't necessarily a member of the group the files need to be owned by?

EDIT: Although adding them to the group doesn't copy the files to the share with the correct group. It uses the Gods group. For the backup target the GID needs to be 20, Gods is 103. 

 

 

 

 

 

 

Message 5 of 13
StephenB
Guru

Re: Mimic "Set ownership and permission for ...." in cron?

I never use AFP (no macs), but with CIFS/SMB, using a consistent credential across all my PCs solves the problem. That credential needs to be authorized for full access.  

 

After you apply this credential to the PCs you probably should reset the share ownership to match that credential (once).

Message 6 of 13
gonzonia
Aspirant

Re: Mimic "Set ownership and permission for ...." in cron?

I have no PCs and only use AFP. 

 

 

Message 7 of 13
StephenB
Guru

Re: Mimic "Set ownership and permission for ...." in cron?


@gonzonia wrote:

I have no PCs and only use AFP. 

 

 


You have PCs, you just call them "Macs". Smiley LOL

 

You can try the same thing I just outlined with AFP.  You can also use SMB with OSX - Apple has been shifting away from AFP (at least appleinsider and some other sites reported that a few years back).

Message 8 of 13
gonzonia
Aspirant

Re: Mimic "Set ownership and permission for ...." in cron?

I know I'm using a consistent credential on the Macs. The issue seems to be with the group id. The default when creating a file on the ReadyNAS is 103 (Gods). The default on the Mac is 20 (staff). 

 

When the backup job happens from the ReadyNas to another Mac using Remote NFS (I tried Windows/NAS and couldn't get the connection to work) , the system attempts to preserve ownership. This fails because of the group owner of the files that have been added. 

 

If I run the "Set ownership and permission for existing files and folders in this share to the above settings." where the group id is the group on the ReadyNAS with an id of 20 it fixes the problem.

 

This is why I'd like to just have a way to automate whatever command that uses. I just need to know what command it is running. I'm sure it's a chown but I'd like to know the exact paramaters so nothing else gets broken.

 

 

Message 9 of 13
StephenB
Guru

Re: Mimic "Set ownership and permission for ...." in cron?

If you run top and use the "c" toggle you can see that the commands are chown -R user:group /c/sharename and chmod -R xxx /c/sharename (xxx being determined by the permissions you set).

 

This still seems like the wrong solution to me.  Why not just create a matching group on the mac?  or reset the GID for staff?

Message 10 of 13
gonzonia
Aspirant

Re: Mimic "Set ownership and permission for ...." in cron?

Thanks. I actually would have prefferred to change the Gods GID but 20 was used by something already. 

I'm worried that changing the staff GID will create more headaches than it's worth. While not the most elegant solution, scheduling the command to run nightly will fix the problem.

 

 

Message 11 of 13
StephenB
Guru

Re: Mimic "Set ownership and permission for ...." in cron?

20 is used by avahi on 4.2.x NAS.  

 

I wouldn't be cautious messing with the default user/groups, since it could lead to side effects, and could come unglued later on if you need to do an OS reinstall.

Message 12 of 13
gonzonia
Aspirant

Re: Mimic "Set ownership and permission for ...." in cron?

Yeah. That's why I only set the file/directory owners in that one share I'm backing up to the matching UID/GID. I was able to match the UID easy enough without affecting any other UID but the GID as you pointed out is used by avahi

 

I don't think changing the owner on the share will impact anything else though which is why I think this is actually the safest way to make it work. 

 

 

Message 13 of 13
Top Contributors
Discussion stats
  • 12 replies
  • 2998 views
  • 1 kudo
  • 2 in conversation
Announcements