DEV Community

Cover image for Don't make this mistake  sudo chown -R 'userName' /*
Ismael Garcia
Ismael Garcia

Posted on • Edited on

1 2

Don't make this mistake sudo chown -R 'userName' /*

Recently I was trying to change the owner for the folder that a docker compose volume created and I accidentally ran the following command

 sudo chown -R 'userName' /*
Enter fullscreen mode Exit fullscreen mode

Then hell broke lose, so now probably you are in the same situation.

Reboot your computer and hold F11 (Please check which one is for your computer, F8 is the case on my computer) after the BIOS splash to bring up the GRUB boot menu. If you use one of the popular distros of linux (something like Ubuntu), there should be an option to start linux in recovery mode (the option might be found under 'Advanced Options' sub-menu if you use GRUB 2). Start linux in recovery mode.

Then select the option that will give you a root prompt. Since the shell is logged in as root, all commands will be run as root without needing the sudo command. You can use this to repair the permissions on /usr/bin/sudo:

chown root:root /usr/bin/sudo
chmod u+s /usr/bin/sudo
exit
Enter fullscreen mode Exit fullscreen mode

After this you can reboot to regular mode that should fix it

view raw socials.md hosted with ❤ by GitHub

Billboard image

The fastest way to detect downtimes

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitoring.

Get started now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay