hi all,
i have a simple query with how file permissions are implemented.
here is how it goes.
1. As a root user i created two users u1 and u2
2. created a /share folder on root directory and gave 777 permission to it.
3. logged into u1 and created a file t1
4. logged into u2 and created a file t2
5. logged back into root and did a chmod 600 to the files in /share drive
6. now when i log into u1 and edit file t2 (which has owner u2:u2) it allows me to force edit the file even though the file doesnt have permissions for the user to edit it
the code is below. am i missing anything here?
Code:
[root@localhost ~]# useradd u1
[root@localhost ~]# useradd u2
[root@localhost ~]# mkdir /share
[root@localhost ~]# ls -l / | grep share
drwxr-xr-x 2 root root 4096 Dec 30 16:00 share
[root@localhost ~]# chmod 777 /share/
[root@localhost ~]# su u1
[u1@localhost root]$ cd /share/
[u1@localhost share]$ touch t1
[u1@localhost share]$ ls -l
total 4
-rw-rw-r-- 1 u1 u1 0 Dec 30 16:04 t1
[u1@localhost share]$ vi t1
[u1@localhost share]$ su
Password:
[root@localhost share]# cat t1
this is u1
[root@localhost share]# su u2
[u2@localhost share]$ cd /share/
[u2@localhost share]$ touch t2
[u2@localhost share]$ ls -l
total 12
-rw-rw-r-- 1 u1 u1 11 Dec 30 16:05 t1
-rw-rw-r-- 1 u2 u2 0 Dec 30 16:05 t2
[u2@localhost share]$ su
Password:
[root@localhost share]# chmod 600 *
[root@localhost share]# ls -l
total 12
-rw------- 1 u1 u1 11 Dec 30 16:05 t1
-rw------- 1 u2 u2 0 Dec 30 16:05 t2
[root@localhost share]# su u2
[u2@localhost share]$ vi t1
[u2@localhost share]$ cat t1
this is u2
[u2@localhost share]$ ls -l
total 12
-rw------- 1 u2 u2 11 Dec 30 16:09 t1
-rw------- 1 u2 u2 0 Dec 30 16:05 t2
[u2@localhost share]$