0

I locked my screen for a moment and now I am unable to login back into my Ubuntu 14.04 machine, not even in a "Guest Session". After a moment of panic, I realized that I am the responsible, as I think I executed the following (I'm 99% sure) a moment ago:

sudo chmod 555 /etc/shadow

Is there a way I can restore the original permissions of /etc/shadow (with an Ubuntu live CD maybe?). I'm also 99% sure no other files were modified in my moment of stupidity.

2

The standard permissions for the file /etc/shadow are 640 (-rw-r-----)

% stat -c "%a %n" /etc/shadow
640 /etc/shadow

% ls -la /etc/shadow
-rw-r----- 1 root shadow 1870 Aug 25 17:32 /etc/shadow

Therefore boot your system in recovery mode (you need only the steps 1..4) and change the permission again:

chmod 640 /etc/shadow

In the recovery mode, you don't need sudo


If that does not work, because you have to enter a password and it does not work, follow Plan B:

  • Boot a Live System
  • Mount the root / partition, usually /etc is not located in its own partition
  • Go into the roou account

    sudo su
    
  • Change the permission

    chmod 640 /etc/shadow
    
  • When I open the root console, I am prompted Give root password for maintenance and I get stuck at that point. – Яois Aug 28 '15 at 7:23
  • Plan B, boot a Live System, mount the partition and change the permission. – A.B. Aug 28 '15 at 7:47
  • I used plan B and it worked. It was worse than I thought, as I had modified the content of /etc/shadow, so what I did was re-generating it from /etc/passwd using pwconv. It didn't even work after that though, so I passwd to generate a new root and user passwords and everything is back to normal now.. hopefully :) – Яois Aug 28 '15 at 8:45

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.