Accidentally gave all permissions to /var/lib

I am using Manjaro KDE. I installed lxd using the official arch wiki. There was some issue. It was not working. Someone recommended using snap. So, I followed the uninstall guide from arch wiki. Everything worked fine but the last command to remove all data. I got read only error. So, I googled and tried to change the permission of all files under the /var/lib/lxd. But, I ran the chmod command accidentally in /var/lib.
Here is the command I used.
chmod -R o+rwx *
Now, the permission of all directories are changed. Whenever I’m trying to use snap to install any app, I am getting the following error.

error: cannot perform the following tasks:
- Run install hook of "lxd" snap if present (run hook "install": /var/lib/snapd has 'other' write 40757)

Please help me. I’m in big trouble. I was just installing lxd for learning purposes and I messed us with my system.

Don’t blindly follow “someone” on the internet and run commands like this. If you think the command can potentially harm your system, first make a backup or try it in a virtual machine or ask on forum.manjaro.org :wink:

AFAIK o+rwx means - remove read, write and execute permission from others.

This error message is complaining about the permissions on the /var/lib directory. With these permissions a regular user can create a file named like /var/lib/whatever which is wrong and has the potential to cause problems.

The default permission for /var/lib is 755 = rwxr-xr-x: readable and executable (you need both for a directory) by everyone, and only writable by root.

Make a backup of your current system and follow this guide. You can use /var/lib instead of /var/.

6 Likes

o+rwx adds those permissions, o-rwx removes them. :slight_smile:

2 Likes

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