I accidentally screwed up permission on /

As someone may know...sometimes we screwed up and make a mess...i accidentally run a command that messed up all permissions and others on root "/".
Me goal was to run command to change permissions in local maps and got the root integrated in command...that f***ed up the box :(

print / -type f -print0 | xargs -0 chmod 0640

Is there a way to recreate default permissions and others?
Now the box can't boot...
Please help and thanks in advance for support.

Best Jonas
 
No guarantee this actually works, it may screw up things even worse:
Code:
mtree -p / -e -u -f /etc/mtree/BSD.root.dist
mtree -p /usr -e -u -f /etc/mtree/BSD.usr.dist
mtree -p /var -e -u -f /etc/mtree/BSD.var.dist

After this you may still need to fix the permissions of the home folders in /usr/home/ but it should get you going again.
 
Thanks SirDice for helpful suggestions.
I went that way, after a detour. I made a boot-USB from Nas4Free (yeah, thats FreeBSD) and booted up my box with all disks disconnected. NAS4Free run a live OS from USB. I connected my problem disk and mounted that to the live-running NAS4Free. Then i ran chmod -R 0755 /mnt/OLD_DISK/. I guessed that i would have a lot of problems with users/groupids and such, so i ran chmod 4755 /mnt/OLD_DISK/usr/bin/su. I check the /etc/mtree/BSD.var.dist and manually set some of the permissions. Now i will let 0755 be on the whole install for a while. The bos isn't on Internet, its on my private network. Then i rebooted the box with my old disk. Now i can boot and everything looks ok. I let this run for a while before i will do a reinstall. Probably more to follow...
Best Jonas
 
Back
Top