Any way to reset the permission of OS to default ?

General support questions including new installations

Any way to reset the permission of OS to default ?

Postby z_haseeb » 2012/02/17 15:19:00

Linux = 5 (RHEL 5)

One of my friend accidently run the command chmod -R 777 / which actually set rwxrwxrwx permission

Any way to reset the permission to default please ? (which can reset the permission as the newly created OS)
z_haseeb
 
Posts: 54
Joined: 2009/12/31 07:58:30

Re: Any way to reset the permission of OS to default ?

Postby SKull » 2012/02/17 16:52:17

Oh my...

well all the system directories (/etc, /bin, etc) in my root have drwxr-xr-x.
all the files in /etc have -rw-r--r--.

files in /bin are -rwxr-xr-x

...

But honestly I would backup all my important conf files and do a fresh install.

[edit]What does the RHEL Support say to this?[/edit]
SKull
 
Posts: 29
Joined: 2011/08/29 06:38:12

Re: Any way to reset the permission of OS to default ?

Postby milosb » 2012/02/17 16:59:52

SKull wrote:
But honestly I would backup all my important conf files and do a fresh install.

I have to disagree and point out that google-ing for "rpm --setperms" returns a less painful solution to the problem.

However, I do agree that this is a question RHEL support should address :-o
milosb
 
Posts: 661
Joined: 2009/01/18 00:39:15
Location: 44 49′14″N 20 27′44″E

Any way to reset the permission of OS to default ?

Postby AlanBartlett » 2012/02/17 17:55:39

Working on the assumption that it may be rather embarrassing to mention that "mishap" to Red Hat support, here's a brash "one-liner" that should solve the problem for the OS packages --

Code: Select all
[b]for P in $(rpm -qa); do rpm --setperms $P; done[/b]

Obviously the users' files and data files will need to be manually adjusted.
User avatar
AlanBartlett
Forum Moderator
 
Posts: 8975
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk


Return to CentOS 5 - General Support

Who is online

Users browsing this forum: No registered users and 1 guest