0

I have inadvertently changed the group ownership of the root directory on my Ubuntu Server 20.04 ☹️ Is there anyway to roll back the changes or reset the group ownership to out of the box (fresh install)?

I used the recursive option with the chgrp command which has obviously changed all files/folders below root. The command I used was sudo chgrp -R sambashare /

Any help or advice would be greatly appreciated

1 Answers1

0

I hope this works :)

I made files with

getfacl -R {dir} >{dir}.facl

for system related directories. Downloads:

Use

setfacl --restore={dir}.facl

to reset them. Warning: Change the bin and var file and replace rinzwind (my username) with your username in the bin and var file before doing this.

If sudo permissions are changed use a live session or grub rescue to do this. A live session will be the easier method if you have one.

Rinzwind
  • 293,910
  • 41
  • 570
  • 710
  • Thank you very much for this. I've tried to execute the command but I didn't have acl package. I tried to install acl but I can't execute commands as root (sudo). I get `sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set` – coombech Feb 18 '21 at 09:29
  • Use a live session to do this. That way the settings for sudo will be reset too – Rinzwind Feb 18 '21 at 09:46
  • thanks, will try that and get back to you. – coombech Feb 18 '21 at 11:41
  • this may seem like a stupid question but do I have to prepend the paths in the files you provided with the mount point of my disk? I'm in a live session and when running the command it's erroring with `No such file or directory` Sorry for the newb questions! – coombech Feb 18 '21 at 14:49
  • That could well be :) I never did this myself so it is a bit of guesswork: if you open the files with gedit or notepad++ you can change the filenames to include your mount point. That would solve this if you indeed need that path – Rinzwind Feb 18 '21 at 15:50