chmod -R 777 / on ubuntu - numerous problems

29,844

Solution 1

I would actually consider doing a full reinstall of the system. Even if you manage to get most permissions right and that things seem to work there will most likely be some special permissions laying around, just waiting to cause trouble.

Alternatively I'd compare the permission with a second, possibly freshly installed, machine. Shouldn't be to hard together with your favorite scripting language.

Solution 2

Wow...it happened to me once too...luckily was a home machine. I solved forcing a reinstall of all packages, so that all permission was set back. It was on debian anyway. I use apt-get install --reinstall $packages in a script that got all packages list. What the syslog or auth say when you try su?

Pier

Share:
29,844

Related videos on Youtube

Pejal Hebat
Author by

Pejal Hebat

Updated on September 17, 2022

Comments

  • Pejal Hebat
    Pejal Hebat over 1 year

    A client has accidentally given the entire filesystem full permissions on their ubuntu 10.04 box.

    chmod -R 777 httpdocs/cd /
    

    As you can see they attempted to cd to the root, and instead gave chmod a fun parameter to play with.

    First sign of the problem was inability to use 'su', giving an authentication error. sudo also complained of a missing setuid bit. This was fixed by logging in as root from the machine itself, and running chmod +s /usr/bin/sudo.

    I can now sudo su and do what I need to as root. su still gives an authentication failure.

    I followed the advice here: http://swiss.ubuntuforums.org/showthread.php?t=1180661&page=2

    chmod 0755 /
    chmod 0755 /*
    chmod 1777 /tmp
    chmod 0750 /root
    chmod 0700 /lost+found
    

    I then tried to reset root password. I still cannot su to become root, or su root.

    The system seems to be running fine. Are there any suggestions for getting su to work once again? Where can I look for more problems?

    • Mayur Bhayani
      Mayur Bhayani almost 14 years
      You should set all home directories to 750: chmod 0750 /home/*
  • Pejal Hebat
    Pejal Hebat almost 14 years
    auth.log shows this: FAILED su for root by username - /dev/pts/3 username:root nothing in syslog cheers
  • PiL
    PiL almost 14 years
    Check permission of the devices /dev/pts (owned by root:tty 640)and give a look to the pam configuration /etc/pam.d. Anyway as Andol suggested, it'd be better to think about a full reinstallation.
  • ThatGraemeGuy
    ThatGraemeGuy almost 14 years
    I'd go with a reinstall. There's just too much to fix in this situation.
  • Philip
    Philip almost 14 years
    I'm not a linux guy, but is there anyway to reinstall all the binaries of the system without overwriting the configuration files?
  • EEAA
    EEAA almost 14 years
    Chris - you just need to do a full reinstall. Anything short of that will be setting yourself up for problems in the future. To be frank, if doing a re-install is that daunting for you, you either need to examine/test your backup procedures, get up to speed on linux administration, or both.
  • jscott
    jscott almost 14 years
    @Chris This is why we all, always, perform backups of important files including config and .files. Lose them once, and you'll be sure to make backupa from then on. You could save the configs and cat their contents into the fresh install if really needed.
  • Pejal Hebat
    Pejal Hebat almost 14 years
    Thanks. Server down at the moment but will do this come Monday and report back.