- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Removing deleted user Home Folders/Directories
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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.
All Replies
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Removing deleted user Home Folders/Directories
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?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.