Restore System Default Permissions in one shot

restore system default permissions - tech tutorials

Restore System Default Permissions

I recently came across a system which had some directories set to 777(recursively), the sysadmin needed to install an application and changed all the permissions a mess, I didn’t know where to start, i find one rpm has a parameter called --setperms and --setugids. most useful stuff when you face above situation.

I created a one liner that does the job, it takes time but It works. The same i want to share below is the one, to run this you have to have an sudo access either root access.

1) To reset uids and gids on files and directories :

~]# for u in $(rpm -qa); do rpm --setugids $u; done

2) To permissions on files and directories

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


Enjoy..!!

Thanks for Your Wonderful Support and Encouragement

More than 40,000 techies are part of our ARKIT community. Join us today and keep learning Linux, Cloud, Storage, DevOps, and IT technologies.

Get Email Updates Download E-Books Facebook Page YouTube Channel Twitter Join Telegram Group Join WhatsApp Group
author avatar
Ankam Ravi Kumar
My name is Ravi Ankam. I am passionate about learning new technologies quickly and sharing knowledge with others. My goal is to help learners grow their skills, because the more you learn, the more you earn. See About Me

Ankam Ravi Kumar

My name is Ravi Ankam. I am passionate about learning new technologies quickly and sharing knowledge with others. My goal is to help learners grow their skills, because the more you learn, the more you earn. See About Me

Leave a Reply

Your email address will not be published. Required fields are marked *