Recovery of directory permissions after modifying the CentOS system

Source: Internet
Author: User

In my work one day after the execution of Chmod-r 777/home I regret very much, this do not know what to do? The heart is very anxious. At this time brainwave asked Google, finally found a way to solve this problem, but the premise is to do their own file rights backup work, and now I will explain to you the process I deal with:

1. Today I will use the/home/tong directory to do experiments to see the/home/tong directory and file existing permissions

[Email protected] home]# ll/home/tong/
Total 0
-rw-r--r--. 1 root root 0 Dec 4 09:45 1.txt
-rw-r--r--. 1 root root 0 Dec 4 09:45 2.txt

2. Back up the file permissions in the directory with the/home/tong directory (be careful not to make this command in the directory you want to back up, preferably at the top level of the directory, write the relative path)

[Email protected] ~]# cd/home/

[email protected] home]# getfacl-r tong/> 11.bak --Backup and save file permissions to a file
Getfacl:removing leading '/' from absolute path names
[Email protected] home]#

3. Modify directory permissions and see if permissions are modified

[email protected] home]# chmod-r 777 tong/ --Modify directory and file permissions
[[email protected] home]# ll/home/tong/ --View file permissions
Total 0
-rwxrwxrwx. 1 root root 0 Dec 4 09:45 1.txt
-rwxrwxrwx. 1 root root 0 Dec 4 09:45 2.txt
[Email protected] home]#

4. Restore directory and File permissions

[email protected] home]# Setfacl--restore=11.bak --Restore directory and file permissions
[email protected] home]# ll tong/ --Success, and wish you all success
Total 0
-rw-r--r--. 1 root root 0 Dec 4 10:16 1.txt
-rw-r--r--. 1 root root 0 Dec 4 10:16 2.txt
[Email protected] home]#

Transferred from: http://www.centoscn.com/CentOS/config/2014/0120/2387.html

Recovery of directory permissions after modifying the CentOS system

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.