Solved

Resetting Directory Permissions to defaults CentOS

Posted on 2013-01-17
9
597 Views
Last Modified: 2013-01-22
Is it possible to globally reset directory permissions for a server running CentOS?  The problem occurred in efforts to allow ftp to a test server.  While testing the different ways to allow access I accidentally made a change that appears to have change all directories in the root.  I have limited Linux experience so need details on what my options are?  Thanks.
0
Comment
Question by:ws11
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
9 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 38788493
Unfortunately the answer is NO.  It is time to get your data from backup.  In a sensible backup, you preserve all permissions, ACLs, SELinux setting, etc.  If you have changed all the permissions and you don't have a backup, well,  if you have a very similar system, you can list the file permissions for each file and try resetting them, or you can reinstall the system but no matter what you do, you have unfortunately a long day ahead of you.
0
 

Author Comment

by:ws11
ID: 38788730
You recommended the following in another post.  What does this do?

df -hT /path/of/directory
ls -ld /path/of/directory
getfacl /path/of/directory
getenforce

Also shouldn't I be able to change setting so I can edit the SELinux config?  I don't seem to be able to do this.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 38788780
df -hT /path/of/directory
To see which partition is  the file located that was creating problem.


ls -ld /path/of/directory
See the directory permissions.  And whether extended permissions are set.

getfacl /path/of/directory
Get ACL settings, to see all the permissions set.

getenforce
To see SELinux enforcing mode.

I wanted to partition because sometimes some partition becomes read only.  You cannot change permission for read only partitions as well.  In other words I am trying to see all possible reasons for this kind of behavior.
0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 38788812
If it's a test server, and if you don't have a backup, what's the harm of reloading?

Also, if what you are doing is running tests, perhaps you might want to think about using virtual machines, such as VMware, where reloading is pretty simple.

My advice here is based on this being a test server and not something like a real server.
0
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 250 total points
ID: 38788847
I think hmccurdy is right.  If it is a test machine you should consider reinstalling since your system files seem to have incorrect permissions and the system appears to be acting up.
0
 

Author Comment

by:ws11
ID: 38789207
I understand and I agree.  I was simply trying to avoid having to do so and hopefully gain more understanding.  As mentioned in the other post chmod -R 777 * was used on the root I believe as well as the SELinux was set as disabled.  I did not know changing to disabled could result in the file system no longer having the correct security context.  I am not sure I understand how to create a flag file. Also do you know anything about the fixfiles relabel command?
0
 
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 38789404
I'll add that 777 would guarantee the FS no longer has the correct security context.

You also said you were new at Linux.  Loading Linux is a good thing to practice.  I've had my Linux Networking students load their systems at least twice and some of them a few more times.
0
 

Author Comment

by:ws11
ID: 38789565
So are you saying that if I could change the SELinux back to original settings that it would not make a difference?
0
 
LVL 13

Accepted Solution

by:
Hugh McCurdy earned 250 total points
ID: 38790119
I would be surprised but I'm not going to say it won't happen since I've never tried messing up my permissions and then seeing if SELINUX would fix them.  You could try it and see.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Ubuntu not booting - How get past GRUB? 3 83
The better OS Architecture 13 91
RPM creation 6 23
DB2 9.7 Grant Execute SP 4 16
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question