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

Amazon S3 not sync for ReadyNAS home directories

akbeer
Aspirant

Amazon S3 not sync for ReadyNAS home directories

I have a ReadyNAS 2304 that has been syncing a share to an Amazon S3 bucket for a few years. This has worked well. I recently configured a second session on the ReadyNAS to sync the user home directories to a second directory in the same S3 bucket. The behavior is interesting in that it is only synching two of the user home directories, and not the remaining five. No related errors that I can see in the log files. I am using the most current firmware (6.10.10 - previously was using/tried on 6.10.8). I've ripped out the session and recreated. I've tried synching both /home and /data/home (/home is just a softlink to /data/home). The only other thing that I can think of is that it is possible that I had created a some of the home directories manually / they may not have been created by the frontend webpage. The permissions appear to be the same on all of the home directories, at least, the home directories themselves.

Message 1 of 14

Accepted Solutions
Sandshark
Sensei

Re: Amazon S3 not sync for ReadyNAS home directories

Home "directories" are actually BTRFS sub-volumes if properly created by the OS.  They are only created automatically after the first time the user logs in.  So if you created a user and then, not finding the home directories, manually created them as standard directories, that could be the issue.  Once you created them, the OS could no longer create the sub-volumes because there would be a name conflict.

 

There is a command available via SSH to force creation of home directories, it's mkhomedir_helper.

 

See if btrft subvolume list /home shows them as subvolumes.  If it doesn't, you can move the incorrectly created directories elsewhere, properly create hem, and then copy the contents of the old ones to the new ones.

View solution in original post

Message 3 of 14

All Replies
StephenB
Guru

Re: Amazon S3 not sync for ReadyNAS home directories


@akbeer wrote:

The only other thing that I can think of is that it is possible that I had created a some of the home directories manually / they may not have been created by the frontend webpage. The permissions appear to be the same on all of the home directories, at least, the home directories themselves.


Did you check the ACL?

How did you create them?

Message 2 of 14
Sandshark
Sensei

Re: Amazon S3 not sync for ReadyNAS home directories

Home "directories" are actually BTRFS sub-volumes if properly created by the OS.  They are only created automatically after the first time the user logs in.  So if you created a user and then, not finding the home directories, manually created them as standard directories, that could be the issue.  Once you created them, the OS could no longer create the sub-volumes because there would be a name conflict.

 

There is a command available via SSH to force creation of home directories, it's mkhomedir_helper.

 

See if btrft subvolume list /home shows them as subvolumes.  If it doesn't, you can move the incorrectly created directories elsewhere, properly create hem, and then copy the contents of the old ones to the new ones.

Message 3 of 14
akbeer
Aspirant

Re: Amazon S3 not sync for ReadyNAS home directories

Ahh, thank you for the information!  Using the btrfs command I was able to determine that the only two home directories that were syncing were the two that I must have manually created.  The ones that were created properly / by the system / with mkhomedir were the ones that were not syncing.  

I found that I can solve the syncing problem by manually creating a syncing session for each home directory itself (/data/home/userxx) instead of the broader /data/home).  

 

One more question.  I see in each home directory (including the ones that I manually created), the system creates an .ssh folder with an empty ssh_authorized_keys file, perhaps to keep users from logging in via ssh.  I have been unable to delete this file which is preventing me from deleting the two manually created home directories (even after renaming them).  As root I should have permissions and using getfacl I don't see a reason why I shouldn't be able to.  If trying to do via the command line, I get an error 'rm: cannot remove 'ssh_authorized_keys': Operation not permitted'.  If I delete via the web front end it just silently fails.  

 

Message 4 of 14
Sandshark
Sensei

Re: Amazon S3 not sync for ReadyNAS home directories

My NAS have no such files in the home folders.  Perhaps they were created due to the S3 sync?

Message 5 of 14
akbeer
Aspirant

Re: Amazon S3 not sync for ReadyNAS home directories

The file and .ssh directory exist in ALL home directories, even the ones that I haven't yet setup to sync with S3.  I had even tried rebooting the NAS as well.  Not a huge deal I guess, just a little messy.  

Message 6 of 14
StephenB
Guru

Re: Amazon S3 not sync for ReadyNAS home directories


@Sandshark wrote:

My NAS have no such files in the home folders.  Perhaps they were created due to the S3 sync?


Did you look in the .ssh folder?

 

root@NAS:~# cd /home/admin
root@NAS:/home/admin# ls -als
total 4
0 drwx------ 1 admin admin  34 Jan 26  2022 .
0 drwxr-xr-x 1 admin admin  10 Mar 12  2023 ..
4 -rw------- 1 admin admin 404 Mar 12  2024 .bash_history
0 drwx------ 1 admin admin  38 Mar 21  2022 .ssh
root@NAS:/home/admin# ls -als .ssh
total 0
0 drwx------ 1 admin admin 38 Mar 21  2022 .
0 drwx------ 1 admin admin 34 Jan 26  2022 ..
0 -rw------- 1 admin admin  0 Mar 21  2022 ssh_authorized_keys
root@NAS:/home/admin#
Message 7 of 14
akbeer
Aspirant

Re: Amazon S3 not sync for ReadyNAS home directories

Yes, your picture details exactly what I am seeing.

 

I'm a bit confused as you said above that the files didn't exist on your NAS, but the picture you sent shows that they do?


Message 8 of 14
StephenB
Guru

Re: Amazon S3 not sync for ReadyNAS home directories


@akbeer wrote:

Yes, your picture details exactly what I am seeing.

 

I'm a bit confused as you said above that the files didn't exist on your NAS, but the picture you sent shows that they do?


@Sandshark said they didn't exist - not me.

Message 9 of 14
Sandshark
Sensei

Re: Amazon S3 not sync for ReadyNAS home directories

root@RD5200A:/# ls /home/admin -all
total 4
drwx------ 1 admin admin  26 Apr 20  2023 .
drwxr-xr-x 1 admin admin  34 Mar 31  2023 ..
-rw------- 1 admin admin 349 Mar 12  2024 .bash_history
root@RD5200A:/# ls /home/admin/.ssh -all
ls: cannot access '/home/admin/.ssh': No such file or directory
Message 10 of 14
StephenB
Guru

Re: Amazon S3 not sync for ReadyNAS home directories

@Sandshark:  Just wondering - if you log in with ssh using admin credentials, does that trigger creation of ssh_authorized_keys ?

Message 11 of 14
akbeer
Aspirant

Re: Amazon S3 not sync for ReadyNAS home directories

Except I've never logged in via SSH as any of the other users.  In fact, none of the users are permitted shell access via SSH by way of configuration defaults in the web front end and verified by their shell being set to /bin/false.

 

I've also deleted one of the users (via the web front end), and I'm still unable delete their home directory because I can't delete the ssh_authorized_keys file within.  I also can't change the ownership of the file from the original username that no longer exists.  Nor can I change the file's permissions.  All return 'Operation not permitted' errors.

Message 12 of 14
Sandshark
Sensei

Re: Amazon S3 not sync for ReadyNAS home directories


@StephenB wrote:

@Sandshark:  Just wondering - if you log in with ssh using admin credentials, does that trigger creation of ssh_authorized_keys ?


Nope.  I just looked at a couple of less-used NAS, both Pro2's converted to OS6, and both of them do have it.  But my main RD5200 and two backup RN4200V2 units all running OS6 as well as an RN516 don't.  I never had ReadyCloud enabled for any of the NAS that don't have it, but may have for the others.  I can't think off-hand of anything else that I uniquely did on the two Pro2's.  One is a "sandbox" unit, so I have done a lot with it.  The other hosts OwnCloud and isn't used for anything else.

Message 13 of 14
StephenB
Guru

Re: Amazon S3 not sync for ReadyNAS home directories


@Sandshark wrote:

@StephenB wrote:

Just wondering - if you log in with ssh using admin credentials, does that trigger creation of ssh_authorized_keys ?


I never had ReadyCloud enabled for any of the NAS that don't have it, but may have for the others. 


 

That must be it,  The ReadyNAS I checked had ReadyCloud installed in the past, and is currently running 6.10.9.  I just checked my RN102 which was factory reset post-ReadyCloud and running 6.10.10.  No hidden .ssh folder on it.

 

@akbeer - to delete the file, first run chattr -i ssh_authorized_keys That clears the immutable bit, and you can then delete it with rm.

Message 14 of 14
Top Contributors
Discussion stats
  • 13 replies
  • 641 views
  • 0 kudos
  • 3 in conversation
Announcements