During the use of Linux systems, sometimes we will use some tools to backup or restore file permissions for daily file management. In fact, it is not difficult to use the access control list for backup and restore file permissions. The ACL defines the permissions of a single file on a posix-compatible file system based on different owners and groups. The following small series will introduce you to the method of backing up and restoring Linux file permissions.
The following demonstrates how to use the tool to back up and restore Linux ACL file permissions
1. Installation ACL tool
on
in Debian, Ubuntu, Linux Mint
$ sudo apt-get install acl
on CentOS, Fedora, RHEL
$ sudo yum install acl
2. Back up the current directory (including subdirectories) Permissions for all files
[root@linuxprobe tmp]# ls -l
total 8
-rwxr--r--. 1 root root 0 Mar 3 04:40 install.txt
-rwxr-xr-x. 1 root root 0 Mar 3 04:41 linuxprobe.txt
[root@linuxprobe tmp]# Getfacl -R . Attributes.txt
...
This command writes the ACL information of all files to the file named permissions.txt.
The following is part of the directory information in the generated permissions.txt file
[root@linuxprobe tmp]# cat permissions.txt
# file: .
# owner: root
# group: root
# flags: --t
user::rwx
group: :rwx
other::rwx
# file: install.txt
# owner: root
# group: root
User::rwx
group::r--
other::r--
# file: linuxprobe.txt
# owner: root
# group: root
user::rwx
group::rx
other::rx
# file: permissions .txt
# owner: root
# group: root
user::rw-
group::r--
other::r--
...
3. Modify a file permission, such as: modify linuxprobe.txt and install.txt permissions
[root@ Linuxprobe tmp]# chmod 733 linuxprobe.txt
[root@linuxprobe tmp]# chmod 573 install.txt
[root@linuxprobe tmp]# ls -l
tot Al 8
-r-xrwx-wx. 1 root root 0 Mar 3 04:40 install.txt
-rwx-wx-wx. 1 root root 0 Mar 3 04:41 linuxprobe .txt
-rw-r--r--. 1 root root 4361 Mar 3 04:41 permissions.txt
.....
4.Restore original permissions
1)cd to create permissions.txt Where the directory is located
2) Execute the following command:
setfacl --restore=permissions.txt
You can see the linuxprobe.txt and install.txt permissions restored. >
[root@linuxprobe tmp]# setfacl --restore=permissions.txt
[root@linuxprobe tmp]# ls -l
total 8
- Rwxr--r--. 1 root root 0 Mar 3 04:40 install.txt
-rwxr-xr-x. 1 root root 0 Mar 3 04:41 linuxprobe.txt
-rw-r--r --. 1 root root 4361 Mar 3 04:41 permissions.txt
......
The above is the way to back up and restore Linux file permissions, in order to avoid some careless operation The system files are corrupted. You can learn the above methods to back up and restore files.
Linux users when viewing the system log found that the iis server could not load the application /lm
Some computers with dual hard drives will prompt boot/efi when there is no space allocated when inst
In the Linux system, the top command can be used to monitor the status of the process, or to modify
Pragha is a music player under Linux, PPA installation, because there are not many people, so many f
Linux how to use cp command guide
Linux system call fork() function method
RHEL 6.0 system sudo switch user is too slow how to do?
How to change the name of Linux multi-network card?
What should I do when Linux upgrades Glibc?
Linux removes the physical volume of PV in LVM
What if Ubuntu can't start Eclipse?
Linux uses the blockdev command to adjust the file read-ahead size
How does Linux distinguish whether a computer has a USB 3.0 interface
Win10 system application uninstall method (simple four steps)
Restore Windows 7 default fonts
Win8 App Store Connection Solution
Under the Win10 system, the QQPCmgr folder can not be deleted. How to solve the
How to adjust the smoke head in CF in win10 CF two ways to set the smoke head and full screen game
Cleverly find the program running in the background of win7 system
Traditional desktop applications in Windows 8 come to the Windows Store
How to disable IE browser on Windows7 system
Win8 must-have tools for playing Weibo
Why is there no increase in memory after the win7 system is added with a memory stick?