1

I use debian jessie and I have done one of those bad mistakes and broke my system with a mistyped command and worse mistakes that follow in such situations.

Trying to fix some permissions I mistakenly used chmod recursively on root folder:

# chmod -R 0644 /

and then realizing immediately I rushed in doing something to stop it but the system was frozen and the worse mistake was the hard powering off the system.

Now I think I have some user manager problem and after booting with some "failed to start service" messages I don't have the Gnome user login and I can't also login in console. And this is what that flashes several times and then stays on screen:

[ ok ] Created slice user-113.slice
       Starting user manager for UID 113...  
[ ok ] Started user manager for UID 113  
[ ok ] Stopped user manager for UID 113  
[ ok ] Removed slice user-113.slice 
Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
jal
  • 363
  • 1
    An article how to reset the permissions on /var only: http://blog.matoski.com/articles/debian-restore-var-ownership-permissions/ - I think a complete re-install is faster and cleaner. – ott-- Apr 07 '15 at 03:34

2 Answers2

3

You remove the execution permission on the files. Moreover you give read permission to the world on some files. Both in combination do not allow you to login. My best advise is to back your files with some live CD and reinstall

Romeo Ninov
  • 17,484
  • Thanks for your answer Romeo. So do you mean that there's no way to recover and I need a fresh installation? Isn't there a way to fix the permissions? – jal Apr 06 '15 at 17:43
  • If you have second system with the same installation you can try to get permissions of all system files. But this is a lot of work. Also you can recover the system from backup (if you have one) – Romeo Ninov Apr 06 '15 at 17:46
1

The good news is that all your data is still there. The mixed news is that your system installation may or may not be recoverable — it depends where chmod stopped.

You will need to boot into a rescue system to repair it. From the rescue system, mount your broken installation somewhere, say /mnt. Issue the following commands:

chmod 755 /mnt
find /mnt -type d -perm 644 >/mnt/bad-permissions
find /mnt -type d -exec chmod 755 {} +

The first find command saves a record of directories with bad permissions into a file. The purpose is to see where permissions have been modified. The second find command changes all directories to be publicly accessible.

You now have a system where all directories listed in /mnt/bad-permissions and all files in these directories are world-readable. Furthermore files in these directories are not executable. Depending on which files were affected, this may be easily repairable or not. See Wrongly set chmod / 777. Problems? for what you can try to get the system functional, to which you should add

chmod a+x /bin/* /sbin/* /usr/bin/* /usr/sbin/* /lib*/ld-*

But even if you manage to get something working, there's a high risk that some permissions are still wrong, so I recommend reinstalling a new system, then restoring your data. How do I replicate installed package selections from one Debian system to another? (Debian Wheezy) should help.