Choose style:

Author Topic: Changing ownership of SD card messed up permissions [SOLVED]  (Read 205 times)

0 Members and 1 Guest are viewing this topic.

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4793
  • Karma: 1001
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 8 Respin-2 (64-bit)
Changing ownership of SD card messed up permissions [SOLVED]
« on: November 29, 2018, 08:00:24 pm »
Hi all, how's it going?  I've managed to mess up my permissions.  I was changing the ownership on SD card that is formatted to ext4.  I changed it so I was the owner.  I stupidly changed everything on the card recursively, instead of by individual folder.  There was stuff on there that should have remained owned by uid 0.  One of them being sudo.  The changes have affected my main drive.  I no longer have sudo access, WiFi is down, the update manager is down and obviously everything else that requires sudo.  Here is the output from a terminal update/upgrade/dist-upgrade:
Code: [Select]
andy@PM9-HP-EliteBook-8470p ~ $ sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y 
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
andy@PM9-HP-EliteBook-8470p ~ $
I've found some solutions but there require logging in as root.  I've kind of run out of ideas  :-\.  I do have a full /home folder backup, so a fresh install is a relatively easy option.  However, I'd like to avoid it if possible  ;).  An alternative solution would be nice for our knowledge base too.  I'm sure I'm not going to be the only one to do this.  Any help would be most appreciated  ;).
« Last Edit: December 01, 2018, 06:51:07 pm by AndyInMokum »
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline murraymint

  • Trusted User
  • Veteran
  • *****
  • Posts: 1749
  • Karma: 292
  • soft boiled with a yolk of gold
    • View Profile
  • Peppermint version(s): 7, 8, 9
Re: Changing ownership of SD card messed up permissions
« Reply #1 on: November 29, 2018, 08:12:14 pm »
You can effectively be root by booting to the recovery console. Otherwise maybe from a live USB? I don't know if you'd need to chroot or not.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 22474
  • Karma: 2509
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R and 9
Re: Changing ownership of SD card messed up permissions
« Reply #2 on: November 30, 2018, 06:19:34 pm »
what's the current output from:
Code: [Select]
ls -l /usr/bin/sudo
and is everything else in /usr/bin owned by someone other than root ?
Code: [Select]
ls -l /usr/bin
should tell you.
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4793
  • Karma: 1001
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 8 Respin-2 (64-bit)
Re: Changing ownership of SD card messed up permissions
« Reply #3 on: November 30, 2018, 06:35:55 pm »
what's the current output from:
Code: [Select]
ls -l /usr/bin/sudo
and is everything else in /usr/bin owned by someone other than root ?
Code: [Select]
ls -l /usr/bin
should tell you.

Thanks guys for the pointer.  I think this output seals the deal:
Code: [Select]
andy@PM9-HP-EliteBook-8470p ~ $ ls -l /usr/bin/sudo
-rwxr-xr-x 1 andy andy 149080 jan 18  2018 /usr/bin/sudo
andy@PM9-HP-EliteBook-8470p ~ $ ls -l /usr/bin
total 209396
-rwxr-xr-x 1 andy andy    51384 jan 18  2018 '['
-rwxr-xr-x 1 andy andy       96 nov 12 15:31  2to3-2.7
-rwxr-xr-x 1 andy andy    10104 apr 23  2016  411toppm
-rwxr-xr-x 1 andy andy       39 feb  5  2018  7z
-rwxr-xr-x 1 andy andy       40 feb  5  2018  7za
-rwxr-xr-x 1 andy andy       40 feb  5  2018  7zr
I haven't bothered to include the remaining 209390 files  :o.  Ownership has been changed to me, andy andy to all of them.  I think a fresh install will be the quickest route.  My /home partition is fully backed up and I have a /DATA partition.  I know how my Saturday morning is going to be spent  :).  Again, thanks a lot guys  ;).
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline pin

  • Trusted User
  • Veteran
  • *****
  • Posts: 1354
  • Karma: 174
  • Peppermint - Void - NetBSD
    • View Profile
  • Peppermint version(s): Peppermint 7 Respin (64bit)
Re: Changing ownership of SD card messed up permissions
« Reply #4 on: December 01, 2018, 01:31:47 am »
Hi Andy!

In one way it might be easier to reinstall, that way you're sure not to forget one or a few directories.
Still, maybe you could try chown those directories from recovery mode...
« Last Edit: December 01, 2018, 02:43:01 am by pin »

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 22474
  • Karma: 2509
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R and 9
Re: Changing ownership of SD card messed up permissions
« Reply #5 on: December 01, 2018, 09:25:14 am »
I'd agree a reinstall is probably best because though it'd be easy to recursively chown the files/directories (either from recovery/single user mode/chroot) it'd still require you set the SETUID bit on "/usr/bin/sudo", and I'm gonna guess there would be others that also require additional steps.

You could be running into little issues for ages.
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec