New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Comments
Nice! Im sure we have all done this before
Nah, I just rsync'd my Minecraft customer's files to a Kimsufi at 5am beig sleepy and didn't see disk space ran out on the kimsufi (stupid /home partinioning of OVH, i stored in /root) and happily wiped my main node, god, that was stupid.
1) Restore your backup into another folder
2) find /folder-of-backup -user username
You will then have a list of full paths owned by each of the original username. Write a simple script that parses the file and re-chown to the original user.
If you can't do it yourself, I'm sure there's some LowEndTech here that will do it for a small fee.
@Kenshin - -I didn't backup the files that in /etc /var and so on...
Oh boy, well then temp solution is to chown everything back to root:root then re-chown whatever you have in backup. At least you didn't chmod, that one would be worse.
Well, can't you make a script to chown it back based on the directory? Assuming you have something that can tell you which user owns which directory.
@Kenshin oh, I fix it now... so tired...
this -> find . -type d -print0|xargs -0 chown user:user .. use 'f' over 'd' for files .. can chmod et al
best bet is to learn you lesson and redo your server because chowning everything as root could open a security hole.
Only two options I can think of:
(1) restore from backup
(2) create a VM with that OS (could even be on a desktop virtualbox/vmware/etc.) and then run a script to capture the ownership of every file and directory, then play that back on your messed up VM
BTW, I always capture /etc in backups. /var maybe not, depending on the filesystem layout, but /etc is a must. It's small (megabytes) and has a ton of config info that is a pain to recreate. In general I capture everything by default and only exclude specific things:
MySQL is listed there only because I do a dump ahead of time and of course the dump directory is backed up.
I could probably add to that list - /lib, /usr/lib, /usr/bin, etc. But in the big scheme, it's better to have too much than too little.
At least it wasn't one of those rm -rf commands, glad you got through and were able to fix it after some hard work @Jylee
Except for /home eventually, and for a given os/distro, the owner will be the same. So I would get the data from another VPS and apply it to the broken one.
buy a second kimsufi and drag the files over you need :-)
Well now you will hopefully never do that again... sudo might have saved you there if you had to enter pass and got a chance to take a 2nd look...
Sudo doesn't ask for password every time.
Depends on the settings in /etc/sudoers
since he didn't use sudo (he ran the command directly as root), I highly doubt he edited that file at all
@Bogdacutuu no, I run sudo su when I connect to my server.
i suggest you, to run!
@bogdacutuu notice I said ”if you had to enter pass”