Take the 2-minute tour ×

I'm having a debian squeeze machine which has been changed recursively its file permissions to basically a position that now its unusable to start applications- terminals even. I googled but couldn't find any useful answers. Is there a way to restore all the default settings in debian squeeze ?

share|improve this question
The file permissions were changed on which filesystems? /etc, system, /usr,/home, all of them? –  Faheem Mitha Jan 15 '12 at 20:17
yes. all of them. almost everything is root. so it doesn't boot into any user account because of this. –  King Jan 16 '12 at 5:44
I see. In that case, your options are (a) compare with a working Debian system and fix permissions manually or (b) backup and reinstallation. I'd recommend (b), which will probably be less time-consuming, and with (a) it is difficult to be sure you have got everything right. –  Faheem Mitha Jan 16 '12 at 8:29
add comment

closed as off topic by Flimzy, casperOne Jan 27 '12 at 22:19


2 Answers

up vote 0 down vote accepted

There really is no need to re-install or any other such drastic measures. With a little work the system will be fine, as long as you still have root access.

You used the phrase "won't boot into any user account." From that I take you to mean that the system will boot you just can't log in as any user other than root.

On any linux distro almost all files on the system except those in /home/[USERNAME] are owned by root.

You are most likely authenticating as the other users just fine, but since their config files, etc. are owned by root the system cannot complete the login process. You can easily verify this by checking /var/log/auth.log

The first thing I'd do is fix the file and directory permissions on the various user directories in /home to the appropriate user and group. This can be done from /home with a simple command.

chown is the program you want. Read the man page for more info but basically just:

chown [path to user's home directory (i.e. /home/user) -R username.username.

Say for instance you had user 'foo'. You'd execute this command:

chown -R foo.foo /home/foo

Add a little for loop and you could change the perms in one fell swoop: (assuming you're using bash):

for i in /home/*; do name=`basename $i`; chown -R $name.$name $i; done

You should now be able to log in as any user just fine.

share|improve this answer
it just boots to the Grub. from there, I'm trying to change these permissions. There are certain things like it fails with some permission for sudo command. Because of which it is not going to the user login screen. There ought to be some things that has to be changed else where also. –  King Jan 23 '12 at 17:41
add comment

The original system won't boot anymore.


  • Boot an OS using another medium,
  • retrieve and backup /home and /etc,
  • re-install Debian,
  • restore backups.

Knoppix is a good system to use to access and restore the first drive, or you could try to boot Debian itself (from another disk or a CD) to do that.

share|improve this answer
Reinstalling is obviously the easiest choice. But I might have so many custom packages installed and getting them back installed would take so much work. I'm just waiting to see if there is any recovery really possible. Because, say a virtual machine can actually restore to a snapshot. Windows has this default settings restore thing. So, I'm eager to know how it can be possible in debian, even its a pain ? –  King Jan 19 '12 at 21:36
add comment
