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

Re: Removing deleted user Home Folders/Directories

Retired_Member
Not applicable

Removing deleted user Home Folders/Directories

Hi all,

 

I've read this: https://community.netgear.com/t5/Using-your-ReadyNAS/Deleting-old-home-directories/m-p/1036582

 

and it seems strange that when creating and removing a user, the home directory/folder for that user can't be removed.

 

I've SSH'd into the box and there's no BTRFS record for the user(s) folder i want to remove, just a locked .ssh file (i didn't even have SSH login enabled for the user!).

 

root@NAS:/home# btrfs subvolume list /data | grep home

ID 257 gen 1195071 top level 5 path home
ID 301 gen 1195071 top level 257 path home/admin
root@NAS:/home# rm user1/ -r
rm: cannot remove 'user1/.ssh/ssh_authorized_keys': Operation not permitted
 
I can't change the permissions of that file either as root.
 
Why can't the WebGUI just allow the deletion/removal of these un-associated home folders?
 
Using: OS 6.9.2/RN316
Model: RN31600|ReadyNAS 300 Series 6- Bay
Message 1 of 6

Accepted Solutions
Retired_Member
Not applicable

Re: Removing deleted user Home Folders/Directories


@StephenB wrote:

You are saying that

  • there is no user account for the home folder you wish to remove?
  • there is no subvolume in /data/home for that user

but there is an ordinary folder for that user???  And that file folder includes the ssh key file that you can't delete?

 

/home is a mount point - did you try deleting the file from /data/home as well?

 

user1 should be showing up in the subvolume list of course.  Maybe also try using btrfs subvolume delete /data/home/user1 even though it doesn't seem to be listed there???

 

Maybe also try rebooting the NAS.

 


1) Yes, there is no user account for the home folder I wish to remove (neither Web GUI or SSH/Shell)

2) Yes, there is no subvolume in /data/home for that user (other than a  hidden .ssh folder, which contains the 0-byte ssh_authorized_keys file)

 

I tried from /home and /data/home, neither worked. When the user gets removed from the webGUI, then users' home folder resorts to its "<UID>:users" group/user permissions drwxrwx--- 1. I can't delete it from webGUI nor SSH.

 

I can't btrfs delete it either:

root@NAS:/data/home# btrfs subvolume delete /data/home/user1/
ERROR: not a subvolume: /data/home/user1/

 

The only thing I can think of is the user/group its in, but as root I should be able to over-ride it.

 

root@NAS:/data/home# ls user1/ -al
total 0
drwxrwx--- 1 105 users 8 May 13 12:18 .
drwxr-xr-x 1 admin admin 200 May 13 13:35 ..
drwx------ 1 105 users 38 Apr 28 15:05 .ssh
root@NAS:/data/home# ls user1/.ssh -al
total 0
drwx------ 1 105 users 38 Apr 28 15:05 .
drwxrwx--- 1 105 users 8 May 13 12:18 ..
-rw------- 1 105 users 0 Apr 28 15:05 ssh_authorized_keys

 

There appear to be no additional attributes or special permissions for the directory, but there are for the file:

./ssh_authorized_keys Immutable

 

I'm guessing this is the reason I can't delete it....remove it and it seemed to have worked. Folder and its contents are now deleted.

 

Not sure if this cause issues, not even sure what set the attribute.

 

View solution in original post

Message 3 of 6

All Replies
StephenB
Guru

Re: Removing deleted user Home Folders/Directories

You are saying that

  • there is no user account for the home folder you wish to remove?
  • there is no subvolume in /data/home for that user

but there is an ordinary folder for that user???  And that file folder includes the ssh key file that you can't delete?

 

/home is a mount point - did you try deleting the file from /data/home as well?

 

user1 should be showing up in the subvolume list of course.  Maybe also try using btrfs subvolume delete /data/home/user1 even though it doesn't seem to be listed there???

 

Maybe also try rebooting the NAS.

 

 

 

Message 2 of 6
Retired_Member
Not applicable

Re: Removing deleted user Home Folders/Directories


@StephenB wrote:

You are saying that

  • there is no user account for the home folder you wish to remove?
  • there is no subvolume in /data/home for that user

but there is an ordinary folder for that user???  And that file folder includes the ssh key file that you can't delete?

 

/home is a mount point - did you try deleting the file from /data/home as well?

 

user1 should be showing up in the subvolume list of course.  Maybe also try using btrfs subvolume delete /data/home/user1 even though it doesn't seem to be listed there???

 

Maybe also try rebooting the NAS.

 


1) Yes, there is no user account for the home folder I wish to remove (neither Web GUI or SSH/Shell)

2) Yes, there is no subvolume in /data/home for that user (other than a  hidden .ssh folder, which contains the 0-byte ssh_authorized_keys file)

 

I tried from /home and /data/home, neither worked. When the user gets removed from the webGUI, then users' home folder resorts to its "<UID>:users" group/user permissions drwxrwx--- 1. I can't delete it from webGUI nor SSH.

 

I can't btrfs delete it either:

root@NAS:/data/home# btrfs subvolume delete /data/home/user1/
ERROR: not a subvolume: /data/home/user1/

 

The only thing I can think of is the user/group its in, but as root I should be able to over-ride it.

 

root@NAS:/data/home# ls user1/ -al
total 0
drwxrwx--- 1 105 users 8 May 13 12:18 .
drwxr-xr-x 1 admin admin 200 May 13 13:35 ..
drwx------ 1 105 users 38 Apr 28 15:05 .ssh
root@NAS:/data/home# ls user1/.ssh -al
total 0
drwx------ 1 105 users 38 Apr 28 15:05 .
drwxrwx--- 1 105 users 8 May 13 12:18 ..
-rw------- 1 105 users 0 Apr 28 15:05 ssh_authorized_keys

 

There appear to be no additional attributes or special permissions for the directory, but there are for the file:

./ssh_authorized_keys Immutable

 

I'm guessing this is the reason I can't delete it....remove it and it seemed to have worked. Folder and its contents are now deleted.

 

Not sure if this cause issues, not even sure what set the attribute.

 

Message 3 of 6
mdgm-ntgr
NETGEAR Employee Retired

Re: Removing deleted user Home Folders/Directories

You may need to use the chown command to change the ownership of the file and/or perhaps the chmod command to modify the permissions before you can delete it.

 

If the files is protected against deletion you may need to use the chattr command with the appropriate option to make the file deletable.

Message 4 of 6
Retired_Member
Not applicable

Re: Removing deleted user Home Folders/Directories

Attribute removed and files + folder deleted.

Would be good to know if
1) Locking (through special attributes, ie Immunize) the ssh key file is normal behavior for user account management

2) Deleting the ssh key will have any implications after the user account has been completely removed from the system?
Message 5 of 6
mdgm-ntgr
NETGEAR Employee Retired

Re: Removing deleted user Home Folders/Directories

1) Locking that using chattr isn't normal, I think, but the user could have chosen to do so.

 

2) That shouldn't have any implications. If there's no user they can't use the SSH key to login to the NAS anyway.

Message 6 of 6
Top Contributors
Discussion stats
  • 5 replies
  • 2768 views
  • 1 kudo
  • 3 in conversation
Announcements