After doing this, on our main server now I can only login as root, none of the secondary accounts work as the permissions seem to be totally screwed up. Apache is just serving up 403 pages, etc. Any ideas on how I can fix this or is the system hosed?

This question came from our site for professional and enthusiast programmers.

As no one has leaped to answer yet, I'll offer a stab in the dark. Maybe you have something like tripwire and it could provide sufficient information that you can reverse the changes.
–
minopretMar 18 '12 at 4:05

2 Answers
2

As Bill Weiss says, you might find it easier and safer to restore from a known good backup on a clean system. You haven't just messed up the permissions, but you've replaced the files, too. Even if both the source and target machines were the same distribution, there's no guarantee they'll be identical files, and that can cause all sorts of wacky problems.

If you feel you must attempt a restore, there's two ways I an think of going about it. The first is to use your distro's package manager to to a force-reinstall of the packages owning the affected files. The second is the more manual approach:

Use your system's package manager to find out what owns every one of those files.

Set up a new system and ensure you install exactly the same versions of those packages on it

Upload a copy of the files to the server

Boot the server in single-user mode and carefully replace all the files.

Set the permissions/ownership to match.

Reboot

You might then find you have a working system again, but I wouldn't trust it and it would probably take longer than the clean/restore route.

Here's a useful command you can run on a list of the full paths of the affected files to get a list of affected packages (Debian/Ubuntu):

Turns out all that required was a simple chmod fix. When I ran the rsync, I discovered it changed "/" to match that of the chroot, as well as the UID which caused my permission issues. Crisis adverted. Thanks for the tips though!
–
xsphereMar 18 '12 at 21:08

For the future you may wish to look into rdiff-backup as an alternative to rsync. Specifically because rdiff-backup has a flag to only increment an existing backup, at least then the risk of repeating is gone.