Now, we are going to give permissions to the nobody group and other users. Note that when you are applying ACLs for other users, it is like when you are handling the chmod command.
[root@centos logs]# setfacl -m g:nobody:-w- 002.log
[root@centos logs]# setfacl -m o:rw- 002.log
[root@centos logs]# getfacl 002.log
# file: 002.log
# owner: root
# group: root
user::rw-
user:nobody:r-x
group::---
group:nobody:-w-
mask::rwx
other::rw-
In order to remove ACLs, we may delete them for a specific user, clear all entries or only get rid of the default ACLs.
[root@centos logs]# setfacl -x g:nobody 002.log
[root@centos /]# setfacl -R -b /logs
[root@centos /]# setfacl -k /logs
Other handy option for ACLs is to associate a mask with an ACL, that is to say, to establish real or effective permissions on a file or directory. In this case, we are limiting the permissions available on a file or directory. For instance, in the following case we are setting read, write and execution permissions for nobody user, but afterwards, we are also applying a mask of just execution.
[root@centos logs]# setfacl -m u:nobody:rwx 002.log
[root@centos logs]# setfacl -m m:--x 002.log
[root@centos logs]# getfacl 002.log
# file: 002.log
# owner: root
# group: root
user::rw-
user:nobody:rwx #effective:--x
group::---
mask::--x
other::rw-
No comments:
Post a Comment