Go through these commands I have mentioned above and this should help you:
Create a directory and assign full permissions to everyone:
Code:
[root@localhost ~]# mkdir /work ; chmod 777 /work
[root@localhost ~]# ls -ld /work/
drwxrwxrwx. 2 root root 4096 Aug 9 15:25 /work/
Log-in as an ordinary user and create a file in the directory created above:
Code:
[root@localhost ~]# su - demo
[demo@localhost ~]$ touch /work/hello-demo
[demo@localhost ~]$ ls -l /work/hello-demo
-rw-rw-r--. 1 demo demo 0 Aug 9 15:26 /work/hello-demo
[demo@localhost ~]$ logout
Now disallow the above user only from creating anything in the /work directory:
Code:
[root@localhost ~]# getfacl /work/
getfacl: Removing leading '/' from absolute path names
# file: work/
# owner: root
# group: root
user::rwx
group::rwx
other::rwx
[root@localhost ~]# setfacl -m user:demo:-w /work/
[root@localhost ~]# getfacl /work/
getfacl: Removing leading '/' from absolute path names
# file: work/
# owner: root
# group: root
user::rwx
user:demo:-w-
group::rwx
mask::rwx
other::rwx
Now let's see demo can create anything in /work:
Code:
[root@localhost ~]# su - demo
[demo@localhost ~]$ touch /work/hello-demo
touch: cannot touch `/work/hello-demo': Permission denied
[demo@localhost ~]$ ls -l /home
total 19
drwx------. 30 demo demo 3072 Aug 9 14:19 demo
drwx------. 4 Devarishi Devarishi 1024 Jun 4 13:30 Devarishi
drwx------. 2 root root 12288 May 31 10:20 lost+found
[demo@localhost ~]$ logout
How about the others?
Code:
[root@localhost ~]# su - Devarishi
[Devarishi@localhost ~]$ touch /work/hello-Dev
Sounds good to you?