LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Taking ownership of folders (https://www.linuxquestions.org/questions/linux-security-4/taking-ownership-of-folders-4175735256/)

DragonspitPublishing.Com 03-24-2024 02:32 PM

Taking ownership of folders
 
I use Linux Mint 21.2 Cinnamon. I'm trying to clean up my system after uninstalling Turboprint.

I used Synaptic Package Manager to delete the package, but got this readout at the end.

(Reading database ... 827268 files and directories currently installed.)
Removing turboprint (2.55-1) ...
Processing triggers for man-db (2.10.2-1) ...
(Reading database ... 825986 files and directories currently installed.)
Purging configuration files for turboprint (2.55-1) ...
dpkg: warning: while removing turboprint, directory '/var/log/turboprint' not empty so not removed
dpkg: warning: while removing turboprint, directory '/usr/share/turboprint/profiles' not empty so not removed
dpkg: warning: while removing turboprint, directory '/etc/turboprint' not empty so not removed


So I located '/var/log/turboprint' and tried to delete it, but my system said I don't have permission because I don't have ownership.

How do I take ownership of the folder so I can get rid of it? I want to permanently delete all three:
'/var/log/turboprint'
'/usr/share/turboprint/profiles'
'/etc/turboprint'

Under Permissions, it says the first is owned by lp, the other two owned by root.

Thanks for any help.

Keith Hedger 03-24-2024 02:52 PM

remove as root eg
Code:

sudo rm -rf /path/to/folder

DragonspitPublishing.Com 03-25-2024 11:33 AM

Quote:

Originally Posted by Keith Hedger (Post 6491668)
remove as root eg
Code:

sudo rm -rf /path/to/folder

Perfect! Thanks!

boughtonp 03-25-2024 11:50 AM


 
It should be noted that "sudo rm -rf" is a dangerous command that should be used with care.

Probably running as superuser/root (which is what the sudo does) is enough and the -f (force remove without prompt) is unnecessary.

Using "sudo rm -ri /path/to/remove" makes it interactive - meaning you get a yes/no prompt before each file, and can use Ctrl-C to abort if you accidentally enter an incorrect path.

(Aside: to change ownership, one can use chown command.)


Keith Hedger 03-25-2024 04:24 PM

I think most rm's ( I read somewhere ) wont do rm -r on / without prompting, but yes any command run as root can be destructive, it's how we learn, I know I have accidently erased / because of carelessness, you only do it once or twice and you learn to back up often!
But the warning is right, I came back to this thread to add such a warning but u beat me to it!


All times are GMT -5. The time now is 10:32 PM.