I managed to borde my sudo... I have a backup of the system that I can try restore. However, since sudo is broken I can't overwrite files that are protected.

Guidelines I tired to follow when making and restoring the backup: https://help.ubuntu.com/community/BackupYourSystem/TAR

Basically I want to run

sudo tar -xvpzf /path/to/backup.tar.gz -C / --numeric-owner

Which generates:

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

Any suggestions?

  • You can't resore a full system backup this way. You need to boot from a LiveUSB. – Pilot6 Feb 8 '20 at 10:19
  • Can you boot to runlevel 1? Do you have another account with sudo privilieges, or root account enabled? Otherwise I'd boot a 'live' system & fix the issue (which I take it is you didn't use visudo which evaluates any changes before exiting your chosen editor). – guiverc Feb 8 '20 at 10:19
  • Most likely OP ran something like chmod 777 -R / – Pilot6 Feb 8 '20 at 10:24
  • @Pilot6 yep, chown user1:user1 -R / RIP – Jesper.Lindberg Feb 8 '20 at 10:31
  • Why so many people shoot in their foot? – Pilot6 Feb 8 '20 at 10:33

Generally you can't restore a full-system backup from within a broken system. Especially when sudo is broken.

Yoг need to boot from something else, like Ubuntu LiveUSB. Then you'll be able to restore.

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.