I have this issue that's giving me some headaches. I have a user, let's say "pepito" with its user folder as /home/pepito and inside of it a folder that is /home/pepito/share which actually points to a remote storage defined in /etc/fstab.
The problem is that when I delete the user "pepito" (with userdel) not only the reference to remote folder is deleted but the folder itself! This is non-sense. I don't want the folder in the storage to be deleted. Why is this happening? How can i prevent this?
Prevent remote folder to be erased during user deletion
- KernelOops
- Posts: 428
- Joined: 2013/12/18 15:04:03
- Location: xfs file system
Re: Prevent remote folder to be erased during user deletion
You can't. "userdel" is a rather stupid tool with no real checks on what its doing...
for example, if you try to remove a user with "/" as home dir, userdel will go ahead and delete your entire system... give it a go, try to delete the user "systemd-resolve"
fun stuff!
for example, if you try to remove a user with "/" as home dir, userdel will go ahead and delete your entire system... give it a go, try to delete the user "systemd-resolve"
fun stuff!
--
R.I.P. CentOS
--
R.I.P. CentOS
--
Re: Prevent remote folder to be erased during user deletion
Oh well, in that case, any suggestion of which other command could i use to delete a user?
Thanks!
Thanks!
Re: Prevent remote folder to be erased during user deletion
I would cheat and just remove them from all groups and changed the password first. In case I made the mistake or something changes.
There is usermod but gpasswd can do the trick
gpasswd [option] group
Options: Here only -A and -M options can be combined.
-a, –add : This option is used to add a user to the named group.
-d, –delete : It is used to remove a user from the named group.
-r, –remove-password : It is used to remove the password from the named group.
-R, –restrict : This option will restrict the access to the named group.
-A, –administrators : Set the list of administrative users.
-M, –members : It set the list of group members.
-h, –help : It displays the help message and exit
from: https://linux.die.net/man/1/gpasswd
I hope it helps
There is usermod but gpasswd can do the trick
gpasswd [option] group
Options: Here only -A and -M options can be combined.
-a, –add : This option is used to add a user to the named group.
-d, –delete : It is used to remove a user from the named group.
-r, –remove-password : It is used to remove the password from the named group.
-R, –restrict : This option will restrict the access to the named group.
-A, –administrators : Set the list of administrative users.
-M, –members : It set the list of group members.
-h, –help : It displays the help message and exit
from: https://linux.die.net/man/1/gpasswd
I hope it helps