Monday, June 24, 2013

How to reset file system permission in Red hat linux enterprise edition?

I executed command in terminal:-- chmod -R 777 /* 

So it caused the file permission to change for all my filesystem causing SSHD to fail. 
How can i revert back to previous setting?
There are alot of files/directories that were changed with that command. If you need to change them all back to what they were you might want to 
consider going to your latest tape backup
.
You run very dangerous command in LINUX OS. But I have a Perfect solution for U 
# *for p in $(rpm -qa); do rpm --setperms $p; done** 
Run above command, it will reset permission of all files that is available 
by any installed package .
 
You can not change permission to original form if you have backup, you can extract name & permission and write simple 
script 
otherwise change permissions to "700" (better than 777)
In that case find all the folder under / directory with the permission 777 replace with 755, except /home/<username> 
for /home/<username> change the permission to 700 
Same thing for the file also it should be 644 under /home/<username> it 
should be 664 
make sure /*etc*/*securetty* has 600 permission. And login via ssh u should 
be able to.
This is but one reason why I use zlister (found on ibiblio) to maintain current state of all Unix production systems. 

After zlister has been executed (at least the first time), and the 
once-dreaded chmod like you indicated has been run, 
zlister can empirically reassert the correct (i.e. previous) state for 
owner, group and permissions throughout the entire 
file system to include directories, block/character devices, files, named 
pipes, fifo's, and links. 

Something to consider. 
 

0 comments:

Post a Comment

 
Design by BABU | Dedicated to grandfather | welcome to BABU-UNIX-FORUM