Permission Troubles - Undo/repair sudo chown on root folder?

I have a new install of Manjaro KDE. (switched from Linux Mint yesterday) I am absolutely new to Linux. This is only day 3 using it.

I was having issues with the root folder not showing up in Dolphin file explorer. Once I was able to view inside /root, I tried to click a file to view and was faced with "Could not enter folder /var/tmp/sysemd-private-ā€¦-ModemManager.service-kmVGPD

Iā€™d not had that issue in Linux Mint. On googling it, I found a forum where it was suggested to use: sudo chown username -R / to gain access.

Iā€™m panicking now that I see what it does!! Luckily, many of the entries in the terminal say " chown: changing ownership of '/sys/firmware/efi/efivars/DeployedMode-8be4df61-93ca-11d2-a
a0d-00e098032b8cā€™: Operation not permitted "

What do I do? Has the entire root ownership been changed or has the chown failed? And why am I having permission issues with ModemManager.service when viewing files? I donā€™t know what to do. 'Please help!

Hi and welcome to the forum :wave:

ls -l / will show who owns what in the /

Most should be owned by root in a fresh install. Question is why you want to look into /root/ folder, there is nothing of interest there, it is a place for the root user config files, this is traditionally a different folder then /home/[username] since /home/ could be on a different drive or even network.
/sys/ is a virtual filesystem (everything is a file) and changing things does indeed produce errors :smiley:
Since your new to Linux this post is a good way to start getting up to speed.

The only help / advice here is to reverse the command to see if it fixes it (remember to make your user the owner of their own home folder) or easier, reinstall to have fresh working system.

Part of example output of ls -l /

lrwxrwxrwx   1 root root          7 20 jan  2021 lib -> usr/lib
lrwxrwxrwx   1 root root          7 20 jan  2021 lib64 -> usr/lib
drwx------   2 root root      16384  4 dec  2020 lost+found
drwxr-xr-x   2 root root       4096 26 sep  2020 mnt
drwxr-xr-x   6 root root       4096  6 mei 20:54 opt
dr-xr-xr-x 404 root root          0 16 aug 21:57 proc
drwxr-x---   9 root root       4096  6 mrt 20:43 root
drwxrwxrwt  17 root root        400 16 aug 23:43 tmp

Root owns the lot by default, other users ( the last 3 positions on the start of the line cannot Read,Write or Execute anything in /root/ but can in /tmp/

1 Like

Thank you so much for the help.

I have no idea how to reverse a sudo chown. Can you provide the code please?

ls -l returns all as being owned by me, not root.

I was simply going in to delete tmp files. This is a normal easy thing in Windows. Thatā€™s why I was in the root folder.

I may have to reinstall. Canā€™t use terminal nowā€¦ this is what I get.

[myusername ~]$ sudo pacman -S latte-dock
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
[myusername ~]$ pacman -S latte-dock
error: you cannot perform this operation unless you are root.

Anyone who suggests such a thing should be slapped, crucified and burned at the stake. Just my opinionā€¦

Gladly you only changed the owner and not the group, but you will have to revert it step b step until there are no problems.

sudo find /etc -user <username> -exec sudo chown -R -v root {} \;

Explanation:

  1. find in folder /etc
  2. -user: only search for files/folders which are owned by <username>
  3. -exec: change the owner for each file/folder to root by this command.
2 Likes

Uppsā€¦ I see. Sudo does not work. ok wellā€¦

If you have a Manjaro Install Disk change the permissions there like explained above.

If not, then try this:

  1. Change to another TTY: CTRL + ALT + F3
  2. You will get a basic login prompt.
  3. Login as root with password (Maybe it is the same as your username)
  4. Then change it there. Root should have full access.

That are tmp files created by systemd. There is a reason why you could not delete or view them, because these files are system files owned by root and needed to work properly.

Your Temp files are located here: $HOME/.cache. /tmp or /var/tmp are commonly used for programs. If you need to delete it, then better mount these folders as tmpfs (it is a ram disk and the files are deleted after reboot).

Something like this:
file: /etc/fstab

# RAM DISK which uses up to 50% RAM by default
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
2 Likes

@megavolt Thank you for taking the time to answer my questions in full with clear direction. Much gratitude.

I tried to follow your instructions (which were fantastic), but it looks like Iā€™m better off reinstalling as fixing this mess is beyond my scope atm.

Actually, I was going to tell you to please first read this like @Hanzel already told you:

Then reinstall

And then definitely read that so you never have this problem again:

:crossed_fingers:

Thanks so much @Fabby . Great read!

1 Like

If you are reinstalling anyway and coming from mint have you thought about manjaro-cinnamon edition? It would give you a desktop you are more accustomed to

That is really great suggestion @sawdoctor .Honestly, I donā€™t want it to be too similar to Winwoes. I really want to learn linux. Iā€™ve learned a ton alreadyā€¦ and love it! Just the start was a little rough, lol. But itā€™s levelling out now. Rocking along with a fresh install.

And I must say, you guys here in the Manjaro community are incredible. Such a massive difference from my previous experiences with ā€œsupport forumsā€. Just, wow.

1 Like

Iā€™ve marked this answer as the solution to your question as Hanzel was the first to point out to reinstall (which will help you in your Linux learning curve anyway :grin: )

However, if you disagree with my choice, please feel free to take any other answer as the solution to your question or even remove the solution altogether: You are in control! (If you disagree with my choice, just send me a personal message and explain why I shouldnā€™t have done this or :heart: or :+1: if you agree)

:innocent:
P.S. In the future, please donā€™t forget to come back and click the 3 dots below the answer to mark a solution like this below the answer that helped you most:
Solution
so that the next person that has the exact same problem you just had will benefit from your post as well as your question will now be in the ā€œsolvedā€ status.

P.P.S. Next time, look for solutions here on the forum instead of executing random code from the Internet that goes like:

Hey, you should try this funny command on Linux, itā€™ll blow your mind away:

echo SSBqdXN0IHRvbGQgeW91IE5PVCB0byBleGVjdXRlIHJhbmRvbSBjb2RlIGZyb20gdGhlIEludGVybmV0ISBXSEFUIElTIFdST05HIFdJVEggWU9VPwo= | base64 --decode  

:stuck_out_tongue_winking_eye:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.