NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

Retired_Member's avatar
Retired_Member
May 13, 2018
Solved

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
  • Retired_Member's avatar
    Retired_Member
    May 15, 2018

    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.

     

5 Replies

Replies have been turned off for this discussion
  • StephenB's avatar
    StephenB
    Guru - Experienced User

    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.

     

     

     

    • Retired_Member's avatar
      Retired_Member

      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.

       

      • mdgm-ntgr's avatar
        mdgm-ntgr
        NETGEAR Employee Retired

        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.

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More