標籤:
在我工作中的某一天執行了chmod -R 777 /home後我十分後悔,這下不知道該怎麼辦?心裏面很是著急。此時靈機一動問了一下穀哥,終於找到了方法解決此問題,不過前提是要自己做了檔案許可權備份工作,現在我就給大家講解一下我處理的過程:
1.今天我就用/home/tong目錄做實驗,查看/home/tong目錄和檔案現有的許可權
[[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.備份/home/tong目錄用目錄下的檔案許可權(注意不要在要備份的目錄下進行此命令,最好是在目錄的上一級進行操作,寫相對路徑)
[[email protected] ~]# cd /home/
[[email protected] home]# getfacl -R tong/ > 11.bak --將檔案許可權備份並儲存到一個檔案中
getfacl: Removing leading ‘/‘ from absolute path names
[[email protected] home]#
3.修改目錄許可權並查看許可權是否修改
[[email protected] home]# chmod -R 777 tong/ --修改目錄及檔案許可權
[[email protected] home]# ll /home/tong/ --查看檔案許可權
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.還原目錄和檔案許可權
[[email protected] home]# setfacl --restore=11.bak --還原目錄及檔案許可權
[[email protected] home]# ll tong/ --成功了,也祝大家成功
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]#
轉自:http://www.centoscn.com/CentOS/config/2014/0120/2387.html
CentOS系統中修改目錄的許可權後恢複