Bug 764522 (GLUSTER-2790) - Permission problem: everybody can delete any files of other users
Summary: Permission problem: everybody can delete any files of other users
Keywords:
Status: CLOSED WONTFIX
Alias: GLUSTER-2790
Product: GlusterFS
Classification: Community
Component: fuse
Version: mainline
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: shishir gowda
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-04-17 19:37 UTC by Alex Aster
Modified: 2013-12-09 01:24 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:


Attachments (Terms of Use)

Description Alex Aster 2011-04-17 19:37:44 UTC
OS: Ubuntu 11.04
GlusterFS 3.1.4
2 Servers(replication:serv3,serv4) and 1 client(serv2).

Client side mounted cluster:
serv3:/volume1 on /cluster/volume1 type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)

How to repeat. Here the file of www-data will be deleted by user1:

www-data@serv2:/cluster/volume1$ touch test.txt
www-data@serv2:/cluster/volume1$ ls -l test.txt 
-rw-r--r-- 1 www-data www-data 0 2011-04-17 23:12 test.txt

user1@serv2:/cluster/volume1$ echo "zzz" > test.txt 
-su: test.txt: Permission denied
it's ok, but here:
user1@serv2:/cluster/volume1$ rm test.txt 
rm: remove write-protected regular empty file `test.txt'? y
user1@serv2:/cluster/volume1$ ls -l test.txt
ls: cannot access test.txt: No such file or directory

The same with "root"-files:
root@serv2:/cluster/volume1# echo "bla" > bla.txt
root@serv2:/cluster/volume1# chmod 600 bla.txt 
root@serv2:/cluster/volume1# ls -l bla.txt
-rw------- 1 root root 4 2011-04-17 23:32 bla.txt

user1@serv2:/cluster/volume1$ ls -l bla.txt
-rw------- 1 root root 4 2011-04-17 23:32 bla.txt
user1@serv2:/cluster/volume1$ rm bla.txt 
rm: remove write-protected regular file `bla.txt'? y
user1@serv2:/cluster/volume1$ ls -l bla.txt
ls: cannot access bla.txt: No such file or directory

Comment 1 shishir gowda 2011-05-09 02:54:28 UTC
Works for me. Tried it with replica/dht/dht-replica.
$mount
sng:/new on /mnt/gluster type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)

test1@shishirng-laptop:/mnt/gluster$ ls -l
total 8
-rw-r--r-- 1 test test 8 2011-05-09 11:12 file
test1@shishirng-laptop:/mnt/gluster$ cat >file
bash: file: Permission denied
test1@shishirng-laptop:/mnt/gluster$ rm file
rm: remove write-protected regular file `file'? y
rm: cannot remove `file': Permission denied
test1@shishirng-laptop:/mnt/gluster$ ls -l
total 8
-rw-r--r-- 1 test test 8 2011-05-09 11:12 file

Can you provide more details of the setup?

Reducing the severity of the bug.

Comment 2 Alex Aster 2011-05-12 12:47:40 UTC
root@serv3:~# gluster volume info all

Volume Name: volume1
Type: Replicate
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: serv3:/media/3
Brick2: serv4:/media/3
Options Reconfigured:
performance.write-behind-window-size: 128MB
performance.cache-size: 512MB
performance.cache-max-file-size: 1MB
network.ping-timeout: 5
performance.flush-behind: on
performance.io-thread-count: 8
auth.allow: 192.168.0.*

root@serv2:~# cat /etc/fstab 
[skip]
serv3:/volume1 /media/volume1 glusterfs auto,noatime,nodiratime,nosuid,noexec,rw,allow_other,default_permissions,max_read=131072,_netdev 0 0  

/cluster/volume1 is a symlink to /media/volume1

What must I write more?

Comment 3 Anand Avati 2011-05-12 21:19:45 UTC
Can you give the output of:

ls -ld /cluster/volume1

Are you sure that /cluster/volume1 directory does not have "other-writeable" permission set?

Avati

(In reply to comment #0)
> OS: Ubuntu 11.04
> GlusterFS 3.1.4
> 2 Servers(replication:serv3,serv4) and 1 client(serv2).
> 
> Client side mounted cluster:
> serv3:/volume1 on /cluster/volume1 type fuse.glusterfs
> (rw,allow_other,default_permissions,max_read=131072)
> 
> How to repeat. Here the file of www-data will be deleted by user1:
> 
> www-data@serv2:/cluster/volume1$ touch test.txt
> www-data@serv2:/cluster/volume1$ ls -l test.txt 
> -rw-r--r-- 1 www-data www-data 0 2011-04-17 23:12 test.txt
> 
> user1@serv2:/cluster/volume1$ echo "zzz" > test.txt 
> -su: test.txt: Permission denied
> it's ok, but here:
> user1@serv2:/cluster/volume1$ rm test.txt 
> rm: remove write-protected regular empty file `test.txt'? y
> user1@serv2:/cluster/volume1$ ls -l test.txt
> ls: cannot access test.txt: No such file or directory
> 
> The same with "root"-files:
> root@serv2:/cluster/volume1# echo "bla" > bla.txt
> root@serv2:/cluster/volume1# chmod 600 bla.txt 
> root@serv2:/cluster/volume1# ls -l bla.txt
> -rw------- 1 root root 4 2011-04-17 23:32 bla.txt
> 
> user1@serv2:/cluster/volume1$ ls -l bla.txt
> -rw------- 1 root root 4 2011-04-17 23:32 bla.txt
> user1@serv2:/cluster/volume1$ rm bla.txt 
> rm: remove write-protected regular file `bla.txt'? y
> user1@serv2:/cluster/volume1$ ls -l bla.txt
> ls: cannot access bla.txt: No such file or directory

Comment 4 Alex Aster 2011-05-13 04:40:42 UTC
# ls -ld /cluster/volume1
lrwxrwxrwx 1 root root 26 2011-04-20 21:33 /cluster/volume1 -> /media/volume1

# ls -ld /media/volume1
drwxr-xr-x 2 www-data www-data 6 2011-03-22 19:19 /media/volume1

Ok, I have found:
 - "www-data" can delete any files, from root too
 - any other user cannot delete files of other users in this folder

For me I have solved problem - just change owner of /media/volume1 to root, but problem stays: "www-data" can delete files of "root"(even with 600) in this folder.

Comment 5 shishir gowda 2011-05-24 09:06:36 UTC
we are not able to reproduce this issue in-house.
Can you please check permissions of users and confirm back?

Comment 6 shishir gowda 2011-05-24 09:13:01 UTC
I see that your parent dir permissions are as follows:
# ls -ld /cluster/volume1
lrwxrwxrwx 1 root root 26 2011-04-20 21:33 /cluster/volume1 -> /media/volume1

# ls -ld /media/volume1
drwxr-xr-x 2 www-data www-data 6 2011-03-22 19:19 /media/volume1

Can you change them to the appropriate level and check if the issues still exists?
Your permissions allows anyone to access/modify the files on the dir

Comment 7 Alex Aster 2011-05-24 09:27:20 UTC
This is simply simlink and it's not a problem, see bottom:
root# ls -ld /cluster/volume1
lrwxrwxrwx 1 root root 26 2011-04-20 21:33 /cluster/volume1 -> /media/volume1


The problem stays. The permission based not on owner of files, but on owner of folder!

root# cat /etc/group | grep root
root:x:0:

I have already changed owner of mount point:
root# ls -ld /media/volume1/
drwxrwxr-x 10 root root 112 2011-05-11 01:42 /media/volume1/

root# cd /media/volume1/
root# mkdir test.www-data
root# ls -l
drwxr-xr-x   2 root       root          6 2011-05-24 16:11 test.www-data
root# cd test.www-data
root# touch test1.txt test2.txt
root# chmod 600 *
root# ls -l
-rw------- 1 root root 0 2011-05-24 16:05 test1.txt
-rw------- 1 root root 0 2011-05-24 16:05 test2.txt

now I switch to www-data:

root# su - www-data
www-data# cd /media/volume1/test.www-data/
www-data# rm test1.txt
rm: remove write-protected regular empty file `test1.txt'? y
rm: cannot remove `test1.txt': Permission denied

and now I change owner of folder:

root# chown www-data /media/volume1/test.www-data/
root# ls -l
drwxr-xr-x   2 www-data   root         38 2011-05-24 16:13 test.www-data

Back to www-data:

www-data# rm test1.txt
rm: remove write-protected regular empty file `test1.txt'? y
www-data# ls -l
-rw------- 1 root root 0 2011-05-24 16:05 test2.txt

We see that owner of folder can delete any files in own folder.

Comment 8 Amar Tumballi 2011-05-24 09:38:28 UTC
I think that is the POSIX standard behavior. Can check that behavior on the backend directly and confirm.

Comment 9 Alex Aster 2011-05-24 10:40:52 UTC
Yes, I confirm that it's POSIX standard behavior. The ticket can be closed.
Thank you!


Note You need to log in before you can comment on or make changes to this bug.