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


//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!

  • 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 ? – Alin Andrei Apr 22 '16 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 – Ilya Shinkarenko Apr 22 '16 at 15:08

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.