Solved

Resetting Directory Permissions to defaults CentOS

Posted on 2013-01-17
9
599 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

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

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

734 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