[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mtime permission



Ethan Benson wrote:

>after more thought regarding xattrs, i looked at the sementecs
>regarding users changing traditional attributes on world writable
>files they don't own, in this case mtime and noticed a bug in XFS.
>
>on ext2 filesystems if i attempt to set the mtime of a file i don't
>own (but do have write permission to) to anything but the current time
>i get -EPERM, but on XFS im allowed to do whatever i want:
>
>eb@dogbert ~$ mount | grep -w /
>/dev/hda3 on / type xfs (rw)
>eb@dogbert ~$ mount | grep /mnt
>/dev/hda4 on /mnt type ext2 (rw)
>
>eb@dogbert ~$ ls -l /dev/null /mnt/null
>crw-rw-rw-    1 root     root       1,   3 Jun 28  2001 /dev/null
>crw-rw-rw-    1 root     root       1,   3 Apr  5 23:47 /mnt/null
>
>eb@dogbert ~$ touch -r /etc/passwd /mnt/null
>touch: setting times of `/mnt/null': Operation not permitted
>eb@dogbert ~$ touch -r /etc/passwd /dev/null
>
>eb@dogbert ~$ ls -l /etc/passwd /dev/null
>crw-rw-rw-    1 root     root       1,   3 Feb 16 06:00 /dev/null
>-rw-r--r--    1 root     root         1408 Feb 16 06:00 /etc/passwd
>eb@dogbert ~$ ls -l /dev/null /mnt/null
>crw-rw-rw-    1 root     root       1,   3 Feb 16 06:00 /dev/null
>crw-rw-rw-    1 root     root       1,   3 Apr  5 23:47 /mnt/null
>eb@dogbert ~$
>
>the same is true for setting time in the future, also the same applies
>to normal files as opposed to regular files.
>
I tried this without hitting the problem here:

burst{lord}:  ls -l /tmp/xxx /xfs/xxx
-rw-rw-rw-    1 root     root            0 Apr 19 02:59 /tmp/xxx    (ext3)
-rw-rw-rw-    1 root     root            0 Apr 19 02:57 /xfs/xxx    (xfs)

burst{lord}:  touch -r /etc/passwd  /tmp/xxx
touch: setting times of `/tmp/xxx': Operation not permitted
burst{lord}:  touch -r /etc/passwd  /xfs/xxx
touch: setting times of `/xfs/xxx': Operation not permitted

Which kernel version were you using?

Steve