Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ To create a file in Linux directory by setfacl     - Docker data container protection the pros and cons (Server)

- Linux operating system security settings initial understanding (Linux)

- MariaDB 10.1 and MySQL 5.7 in general performance on commodity hardware (Database)

- PCM audio under Linux (Linux)

- Oracle bdump file soaring (Database)

- Source encountered problems and solutions when installing SaltStack (Server)

- 2 minutes to read large data framework Hadoop and Spark similarities and differences (Server)

- MySQL and Oracle time zone settings compare (Database)

- Awk include binding capacity larger than the specified size of all files directory (Linux)

- iOS GCD multithreading simple to use (Programming)

- Java in the inverter and covariance (Programming)

- JavaScript function closures Quick Start (Programming)

- Seven kinds of NIC binding mode Detail (Linux)

- Ruby and Python simple comparison (Programming)

- To install HDRMerge 0.4.3 under ubuntu (Linux)

- MySQL DATE_FORMAT () function (Database)

- Use ARChon runtime environment to run Android apps on Ubuntu (Linux)

- Android Dynamic efficiency articles: a brilliant Loading Analysis and Implementation (Programming)

- Advanced network security tips Linux backdoor Technology and Practice (Linux)

- Five useful commands to manage file types and system time in linux (Linux)

 
         
  To create a file in Linux directory by setfacl
     
  Add Date : 2018-11-21      
         
         
         
  In the Linux system, you can create a file or subdirectory to achieve the directory, and inherit permissions from the parent directory by setfacl.

The following root ordinary users user1. In the directory / mnt under

[Root @ RedHat-7 mnt] # setfacl -m u: user1: rwx share // directory Add ower = user1, and given the right to the root of rwx.
[Root @ redhat-7 mnt] # setfacl -d -m u: user1: rwx share // add default acl permissions directory, create directories and files in this directory will inherit the rights information
[Root @ redhat-7 mnt] #
[Root @ redhat-7 mnt] #
[Root @ redhat-7 mnt] # getfacl share // Check facl share the information
# File: share
# Owner: root
# Group: root
user :: rwx
user: user1: rwx // user1 at this time in order to have write access to the share
group :: r-x
mask :: rwx
other :: r-x
default: user :: rwx // default permissions subdirectory or file information
default: user: user1: rwx
default: group :: r-x
default: mask :: rwx
default: other :: r-x
[Root @ redhat-7 mnt] # cd share /
[Root @ redhat-7 share] # ls
[Root @ redhat-7 share] # touch roota
[Root @ redhat-7 share] # touch rootb
[Root @ redhat-7 share] # mkdir rootdir1
[Root @ redhat-7 share] # mkdir rootdir2
[Root @ redhat-7 share] # ls
roota rootb rootdir1 rootdir2
[Root @ redhat-7 share] # getfacl roota
# File: roota
# Owner: root
# Group: root
user :: rw-
user: user1: rwx #effective: rw-
group :: r-x #effective: r--
mask :: rw-
other :: r--
[Root @ redhat-7 share] # getfacl rootdira
getfacl: rootdira: No such file or directory
[Root @ redhat-7 share] # getfacl rootdir
rootdir1 / rootdir2 /
[Root @ redhat-7 share] # getfacl rootdir1
# File: rootdir1
# Owner: root
# Group: root
user :: rwx
user: user1: rwx
group :: r-x
mask :: rwx
other :: r-x
default: user :: rwx
default: user: user1: rwx
default: group :: r-x
default: mask :: rwx
default: other :: r-x
[Root @ redhat-7 share] #

Now enter the directory with user1 detected permissions:

[User1 @ redhat-7 share] $

[User1 @ redhat-7 share] $

[User1 @ redhat-7 share] $

[User1 @ redhat-7 share] $ ll

total 8

-rw-rw-r - + 1 root root 0 Nov 19 22:52 roota

-rw-rw-r - + 1 root root 0 Nov 19 22:52 rootb

drwxrwxr-x + 2 root root 6 Nov 19 22:52 rootdir1

drwxrwxr-x + 2 root root 6 Nov 19 22:52 rootdir2

[User1 @ redhat-7 share] $ touch user1a

[User1 @ redhat-7 share] $ touch user1dir1

[User1 @ redhat-7 share] $ getfacl user1a // Check new file permissions

# File: user1a

# Owner: user1

# Group: user1

user :: rw-

user: user1: rwx #effective: rw-

group :: r-x #effective: r--

mask :: rw-

other :: r--

 


[User1 @ redhat-7 share] $ rm roota // try to delete files created by root, success

[User1 @ redhat-7 share] $ rm rootdir1 // try to delete the root directory was created successfully

rm: can not remove arootdir1a: Is a directory

[User1 @ redhat-7 share] $ rm rootdir1 -r

[User1 @ redhat-7 share] $ ll

total 4

-rw-rw-r - + 1 root root 0 Nov 19 22:52 rootb

drwxrwxr-x + 2 root root 6 Nov 19 22:52 rootdir2

-rw-rw-r - + 1 user1 user1 0 Nov 19 22:57 user1a

-rw-rw-r - + 1 user1 user1 0 Nov 19 22:57 user1dir1

[User1 @ redhat-7 share] $

So, when there is a demand to do the right root of inheritance, you can use the party to achieve.

In the new rhel7, there will be new tools chacl similar setfacl.
     
         
         
         
  More:      
 
- Remove old kernel on Ubuntu (Linux)
- Java regular expression syntax (Programming)
- CentOS 7 virt-manager can not connect a local hypervisor (Linux)
- Reported too many open files Linux solutions (Server)
- Qt shared memory interprocess communication (Programming)
- Linux environment variable configuration and save places (Linux)
- Experience CoreCLR stack unwinding characteristics of initial implementation on Linux / Mac (Linux)
- Docker Basic and Advanced (Linux)
- Compare Swift achieve rapid sorting and sorted Methods (Programming)
- Linux Disk and File Management (Linux)
- Compile Android libwebcore.so error occurs when solving (Programming)
- Security Knowledge: How to hide a backdoor PHP file tips (Linux)
- Installation and Configuration OpenVPN server and client on Ubuntu 15.04 (Server)
- Linux SU command security Suggestions (Linux)
- Use OpenSSL to generate a certificate (Linux)
- Git large file storage will help handle large binary files (Linux)
- DVD production using CentOS installation source within the company Yum (Linux)
- Nginx DHCP TFTP Kickstart set up automatic installation system (Server)
- Eclipse installs support for Java 8 (Linux)
- Linux common commands MEMO (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.