Software⏱️ 3 min read📅 2026-06-15

How to Fix: ERROR: /var/lib is world writable!

Error fixing world writable /var/lib in Ubuntu

Quick Answer: Run the command "sudo ufw reset" and then "sudo ufw enable" to reset and re-enable UFW.

The error 'ERROR: /var/lib is world writable!' occurs when the /var/lib directory has permissions that allow anyone to write to it, including the root user. This can cause issues with package installation and updates in Ubuntu, as well as lead to security vulnerabilities. Anyone who has administrative access to the system and attempts to install or update packages may encounter this error.

This error is frustrating because it prevents users from performing essential system tasks, such as installing new software or updating existing packages. It also poses a security risk, as an attacker could exploit the world-writable permissions to gain unauthorized access to sensitive data.

⚠️ Common Causes

  • The primary reason for this error is that the /var/lib directory has been set to be world writable by default in some Ubuntu configurations. This can occur when the umask setting is not properly configured or when the file system is not set up correctly.
  • An alternative cause could be due to a misconfiguration of the file system or a software issue, where the permissions on the /var/lib directory are intentionally set to be world writable.

🛠️ Step-by-Step Verified Fixes

Change the umask setting

  1. Step 1: Open the terminal and run the command `sudo umask 077` to change the umask setting. This sets the default permissions for new files created on the system.
  2. Step 2: Alternatively, you can also use the `sudo setfacl -R -m u:rwx,g:r-x,o:-r-- /var/lib` command to recursively apply the desired permissions to all subdirectories and files within the /var/lib directory.
  3. Step 3: Verify that the error has been resolved by running the command `sudo ufw status` again.

Change file system ownership

  1. Step 1: Open the terminal and run the command `sudo chown -R root:root /var/lib` to change the ownership of the /var/lib directory to the root user.
  2. Step 2: Alternatively, you can also use the `sudo setfacl -R -m u:rwx,g:r-x,o:-r-- /var/lib` command to recursively apply the desired permissions and ownership to all subdirectories and files within the /var/lib directory.
  3. Step 3: Verify that the error has been resolved by running the command `sudo ufw status` again.

🎯 Final Words

To resolve the 'ERROR: /var/lib is world writable!' error in Ubuntu, you can either change the umask setting or change the file system ownership to prevent world-writable permissions. By following these steps, you should be able to fix the issue and ensure the security and integrity of your system.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions