1

I accidentally typed out this command, not knowing exactly what it did:

sudo chown -R user:user /

Now when I type ls -la /, it shows that user has permission to all directories (before it showed root only).

How do I revert it back to root?

1 Answer 1

0

This is messed up very badly.

For starters:

cd /
chown root:root -R bin boot cdrom etc initrd.img* lib lib64 lost+found mnt opt root  run sbin srv tmp usr var vmlinuz*  
# essentially everything except home and media
chown root:root home media # we don't want to recursively chown here.

I assume you have a root shell open somewhere. If not, try pkexec chown, since sudo won't work when /etc/sudoers has incorrect permissions/owners.

Then there are various folders in /var whose correct owners you'll have to set, but that depends on which programs you have installed and which services you need to run.

If you're not able to run a command, or some other errors happen, try this from a bootable live USB (after mounting the root partition somewhere and replacing cd / with the path of the mount point).

Note that I have skipped a few directories, such as sys, proc, as these are directories populated by the kernel.

0

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.