Results 1 to 9 of 9
Geez. Not the time to make a mistake like this at midnight :P. Arrghh... now iceweasel is highlighting every word as mispelt.
Anyways, I accidentally rm -fr /usr/lib/'ed. It was ...
- 03-21-2008 #1Just Joined!
- Join Date
- Mar 2008
- Posts
- 1
Help! Accidentally bombed /usr/lib/
Geez. Not the time to make a mistake like this at midnight :P. Arrghh... now iceweasel is highlighting every word as mispelt.
Anyways, I accidentally rm -fr /usr/lib/'ed. It was actually an rm -fr * as root, but the cd command before it had a typo.
I'm really tired, but I don't want to shut down my computer yet.
I did keep a backup of the first 10 files in there, obviously no good because there were hundreds of files in there. I cp'd them in anyway. Is it safe to reboot? And most importanty, HOW CAN I RECOVER THESE FILES??
- 03-21-2008 #2Just Joined!
- Join Date
- Mar 2008
- Location
- Canada
- Posts
- 42
>Is it safe to reboot?
If you mean 'safe' as in you won't lose any more files, yup, it's safe. But no, you won't be any better off by rebooting your system (although I would imagine the kernel's still bootable. Your daemons probably won't be happy though).
>HOW CAN I RECOVER THESE FILES??
If you don't have a backup of them, they're gone. Toast. Disappeared. While you could probably recover them with disk recovery software, you'd likely end up with an unstable filesystem that would have to be recreated anyway. I see two options for you: a) recreate the files in /usr/lib -- difficult or b) reinstall your operating system -- not (too) difficult.
If it makes you feel any better, I know a guy who accidentally deleted his entire /etc directory a couple of months ago (regex expression gone wrong :P).
- 03-21-2008 #3
I think you are a bit limited as to what you can do. If you do not have a backup, then you probably have to reinstall the OS from scratch.
- 03-21-2008 #4
this is a great lesson for not using root.
I don't like touching root unless I have to and use sudo whenever possible.
- 03-21-2008 #5Just Joined!
- Join Date
- Mar 2008
- Location
- Canada
- Posts
- 42
I don't see how prepending 'sudo' to every command that you want to do as root is going to keep you from making mistakes...
While it does keep you from accidentally executing commands as root, the issue here I think wasn't that the user didn't realize they were root. It was that they were in the wrong directory when they did rm -fr *, which sudo certainly wouldn't have prevented.
I think the lesson to be learned here is always use 'rm' with caution.
- 03-21-2008 #6
I agree with John A. If you are using sudo then you are gaining root privileges and thats like logging in as root user only.
It is amazing what you can accomplish if you do not care who gets the credit.
New Users: Read This First
- 03-21-2008 #7Just Joined!
- Join Date
- Mar 2008
- Location
- Canada
- Posts
- 42
Well... sudo proponents argue that it prevents the case of someone logging in as root for some administrative task, then forgetting they're root and doing all sorts of normal user operations under root, making your entire system vulnerable (e.g. viruses). Using sudo means that you're very specifically granting one command root privileges, which prevents viruses from taking over the whole system and the "ohmigosh I forgot I was root" syndromes.
- 03-21-2008 #8
I'm not saying make sudo grant you admin access for everything. You can fine tune sudo so when you invoke sudo it will only work for paths or programs that you have explicitly set. Contrary to the default in ubuntu where sudo gives you
username ALL = (ALL)ALL
that is no good.
But if you set certain paths and require them to prompt for a password, then I think you are less likely to remove your whole lib dir for example. Wouldn't you think getting a prompt for password when you do rm -rf * would be a good thing, so you can say hmmm, is that what I meant.
I have sudo setup on a machine at work where other people need to log in to do certain root functions. I don't want to give them root and I don't want to give them sudo with ALL rights. So I setup a Cmnd_Alias in the sudo file that contains only the programs they need, like vi and tail and being able to execute a certain init script (not all, just one). So this user can log in and run those commands as root but can't do anything else as root, like rm -rf or reboot, things that would be bad.
I prefer this to running as root or expecting a user to type whoami before each command so they don't do something wrong.
just my opinion
- 03-21-2008 #9Just Joined!
- Join Date
- Mar 2008
- Location
- Canada
- Posts
- 42
Well -- the main reason I prefer using root login is because I tend to do a lot of administrative tasks in one login, so prepending 'sudo' to every command that I want to do quickly becomes quite tedious. But each to his own.


Reply With Quote

