Question about behaviour when touching files

Uwe Bonnes (bon@elektron.ikp.physik.th-darmstadt.de)
Sun, 13 Apr 1997 02:07:05 +0200


Hallo,

to allow only selected users acces to a (V)FAT partition, I have made the
following:
- I mount the partition like:
mount -t vfat -o uid=18,gid=18,umask=2 /dev/hda1 /dosc
- I add those users allowed to write to that partition to the group 18

Now those users may write and delete files and directories on that
partition, but touching that file to set a date other then than actual date
fails.

igel:~> ls -ld /dosc
drwxrwxr-x 32 dos dos 16384 Apr 12 17:32 /dosc
igel:~> ls /dosc/test
igel:~> id
uid=... groups=...,18(dos)
igel:~> ls /dosc/test
ls: /dosc/test: No such file or directory
igel:~> touch /dosc/test
igel:~> touch -t 04010000 /dosc/test
touch: /dosc/test: Operation not permitted

Strace shows that the call to utime is denied:
utime("/tmp/dosc/test", [97/04/01-00:00:00, 97/04/01-00:00:00]) \
= -1 EPERM (Operation not permitted)

In a test I had the same behaviour with files on a ext2 partition.

In /usr/src/linux/fs/open.c in the else clause it is described:
> /* If times==NULL, set access and modification to current time,
> * must be owner or have write permission.
> * Else, update from *times, must be owner or super user.
> */
> asmlinkage int sys_utimes(char * filename, struct timeval * utimes)

Is this behaviour consistant?

Thanks

-- 
Uwe Bonnes                bon@elektron.ikp.physik.th-darmstadt.de

Free Software: Contribute nothing, expect nothing

--