0

Due to some permission purposes I have changed the group of all folders in /etc. Now I can't log in any more. Is there a way to go back. (I'm using ubuntu 20.04 on a VM)

Many thanks in advance.

2
  • 1
    All top-level folders in /etc should be in the 'root' group. Some files in /etc should not be in that group...but you specified 'folders'. Some subdirectories might need different groups, too, but it's unclear whether your change includes subdirectories or not. There is no 'undo'.
    – user535733
    May 11, 2022 at 15:04
  • Do you remember the command you ran? Was it really only directories?
    – pLumo
    May 11, 2022 at 15:08

2 Answers 2

0

Possible options:

  • Restore a backup if you have one.
  • Restore a VM snapshot if you have one.
  • Boot the VM from an ISO image with a live system to
    • repair your system, if you know what exactly to change (see pLumo's answer), or
    • save your important data, e.g. to a shared folder. Then install a fresh system and restore your saved data.
  • Create a new VM with a fresh install, add the virtual harddisk of your old VM to the new VM and
    • copy your important data directly from the old disk to the new disk or
    • compare the directories between the old disk and the new disk fix the broken ones on the old disk.
0

You can quite easily rollback, as most directories have group root. Only a few directories are different and that should be the same or similar between systems.

Run following commands from a terminal:

# change group for all directories to root
sudo find /etc -type d chgrp root {} +

# change group of some other directories to their default groups
sudo chgrp dip /etc/chatscripts
sudo chgrp dip /etc/ppp
sudo chgrp dip /etc/ppp/peers
sudo chgrp ssl-cert /etc/ssl/private
sudo chgrp lp /etc/cups
sudo chgrp lp /etc/cups/ssl
sudo chgrp lp /etc/cups/ppd

This list is copied from my system, got it with command

sudo find /etc -type d -not -group root -printf 'sudo chgrp %g %p\n'

Your setup might differ slightly, e.g. on another machine I also have /etc/postgresql and subdirs belong to group postgres. Anyways, this should make you be able to login again.

If you cannot access a terminal on the machine, you need to run from a live system, mount your drive and change /etc/ to /path/to/mountpoint/etc/ for the commands above.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .