4

The server dir is mounted with a user, who definitely has "Write Attributes" permissions in Windows.

/etc/fstab:

//server/shared /mnt/fs1 cifs noperm,rw,nounix,iocharset=utf8,gid=java,file_mode=0774,dir_mode=0775,credentials=/localhome/securedir/fs1.credentials 0 0

The mounted files are directories are readable and writeable.

Changing timestamp of a file works:

> touch -t 01010101 /mnt/fs1/test.file

Changing timestamp of a directory results into "Permission denied":

> touch -t 01010101 /mnt/fs1/baselines
touch: setting times of `/mnt/fs1/baselines': Permission denied

Are there any other mounting options I have to apply? Thanks!

2
  • Try mounting under your username, also check this link for more (info)[access.redhat.com/solutions/448263] , also if you run sudo touch will it work ? Apr 22, 2016 at 15:05
  • 1) mounting with own user name is not an option - this user is not known to samba server 2) running with sudo has same result Apr 22, 2016 at 15:08

1 Answer 1

1

The most reasonable answer I got so far is that Windows does not have modification date attribute for directories. There is only a creation date.

This issue can be really confusing when trying to change the directory's modification date with e.g. java.io.File#setLastModified method. Both under Linux and Windows this API works on local directories with predictable result. However, in one particular constellation, which is trying to set modification date of a mounted CIFS directory on a Linux machine, this API fails to change the date and returns false.

1
  • Thanks for this Q&A. What a nuisance this implementation choice is! I'm trying to do a simple rsync -arz or scp -p -r or touch and instead of doing the parts of the operation that are possible, I get "set times: Permission denied", and the modified time and access time, which could have been set, are not. Grrr. My old samba mounts didn't have that problem, they just set the timestamps they could and didn't complain about the creation/modify discrepancy between Windows- and Linux-based file systems.
    – joanis
    Aug 24, 2022 at 15:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .