0

While in the root account I accidentally entered: chmod 700 /

After that I can't do any sudo commands, e.g:

/home# sudo apt-get update
sudo: unable to stat /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

Is there a way to fix this?

3
  • I've tried askubuntu.com/questions/958141/… but everything is Operation not permitted Jul 25, 2020 at 1:12
  • 1
    You'll need an Ubuntu Live USB to run the script from. Jul 25, 2020 at 1:27
  • Stay away from that script. You only changed the root folder itself, not the underlying files and folders. Just correcting the permissions should do. See my answer.
    – vanadium
    Jul 25, 2020 at 12:04

1 Answer 1

1

You changed the permissions of the root folder to a very restrictive state, causing some processes not to have access anymore. Restore to default with the command

sudo chmod / 755

Fortunatelly, you did not add the recursive switch. The damage is only to the root folder itself, and thus can be easily repaired.

3
  • @steeldriver Right you are. So resetting should be good. I will update the post.
    – vanadium
    Jul 25, 2020 at 12:00
  • Thanks although I have reformatted the server already after making a backup. I will accept this answer. Although I think a sample and proof that it works would be good for others to check. Jul 26, 2020 at 10:12
  • Indeed, your command just changed permissions of the single root folder. My first reaction was you did it recursively, and then reformatting would have been the only way. Had an other user recently where / was changed to his own user name. System did fully start, but boot time was several minutes because of that.
    – vanadium
    Jul 26, 2020 at 11:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .