Any way to reset the permission of OS to default ?

General support questions including new installations
Post Reply
z_haseeb
Posts: 102
Joined: 2009/12/31 07:58:30

Any way to reset the permission of OS to default ?

Post by 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)

SKull
Posts: 29
Joined: 2011/08/29 06:38:12
Contact:

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

Post by 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]

milosb
Posts: 661
Joined: 2009/01/18 00:39:15
Location: 44 49′14″N 20 27′44″E

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

Post by milosb » 2012/02/17 16:59:52

[quote]
SKull wrote:
But honestly I would backup all my important conf files and do a fresh install.
[/quote]
I have to disagree and point out that google-ing for [b]"rpm --setperms"[/b] returns a less painful solution to the problem.

However, I do agree that this is a question RHEL support should address :-o

User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Any way to reset the permission of OS to default ?

Post by AlanBartlett » 2012/02/17 17:55:39

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

[code]
[b]for P in $(rpm -qa); do rpm --setperms $P; done[/b]
[/code]
Obviously the users' files and data files will need to be manually adjusted.

Post Reply