0

sudo chmod -R 777 / was entered in an attempt to regain access to directories that were previously accessible, but this caused the SSH connection to be closed and now can no longer be reconnected. A "Login failed." error is displayed. The Pi can still be accessed directly.

Any use of sudo returns sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

How can this be reversed? What did the permission changes do to cause this?

Ctrl S
  • 165
  • In practical terms you restore from your backup or reinstall from scratch. You have hosed your system. There are some answers here (I'll see if I can find a duplicate for you) that explain how you might be able to repair your Pi but basically you've broken it. – Chris Davies Jul 19 '18 at 20:12
  • Sounds broken, haha. Reinstall looks like the cleanest solution. – Ctrl S Jul 19 '18 at 20:16

1 Answers1

-1

You can fix this by removing the SD card and mounting it in another device under /mnt and chmodding the files under /mnt.

Another option is if you can get it to boot by mounting a rescue image you can run aptitude reinstall "~i" which should fix file permissions.

That said unless there is data you can't lose you should reinstall.

Joe M
  • 876
  • A chroot into the system as root and the aptitude reinstall is probably the closest to a decent option.... (For a Pi, it would need to be another ARM-based system, since you use the binaries inside the chroot...) – Gert van den Berg Sep 05 '18 at 07:50