Article ID: 113989, created on May 29, 2012, last review on Jul 22, 2016

  • Applies to:
  • Plesk for Linux/Unix


Accidentally chown and chmod commands were run on system directories like /var, /root, /etc. How to restore correct system files permissions and ownerships?


Permissions can be reset to their defaults using the following commands:

RedHat-like distributions

# for p in $(rpm -qa); do rpm --setugids $p; done
# for p in $(rpm -qa); do rpm --setperms $p; done

Note: The order in which you execute the commands is important. When changing permissions and ownerships on files, always change the ownerships first, and then the permissions. Otherwise, if the files have a SUID bit set, for example, the bit set may get cleared.

See these forum threads for further reference:

Forum #115523

Forum #109342

Additional Information

In some cases, even after running the above commands, the ownerships for some files or folders may still be incorrect. Make sure you check these lists:


You can also verify the correctness of the ownerships you have reset by comparing them with those on a working server.

Search Words

restore permissions


56797cefb1efc9130f7c48a7d1db0f0c a914db3fdc7a53ddcfd1b2db8f5a1b9c 29d1e90fd304f01e6420fbe60f66f838

Email subscription for changes to this article
Save as PDF