0

I don’t want the “last modified” attribute to be updated with the current date when I am copying files to a mounted Samba folder. How can I avoid this behaviour ?

This behaviour occurs with (K)Ubuntu 12.04 and Ubuntu 15.10.

This behaviour can be reproduced using

  • GUI tools: file browsers (tested with nautilus 3.4.2 and dolphin 2.0), sync-tools and
  • CLI commands: cp -p in the terminal.

The Samba folder was mounted to the local file system either with:

  • sudo mount -t smbfs //mynas/folder /mnt/nas/ -o user=username or
  • sudo mount -t cifs //mynas/folder /home/mnt/nas/ -o user=username.

Notes:

  • When connecting to the same Samba folder (either with nautilus or dolphin) using a URL like smb://username@mynas/folder/ then I can copy files to it without having the “modified time” attribute replaced with the current time!
  • But mounting a Samba folder is more convenient and also, not all tools support the smb protocol. This is, why using the URI smb:// is not a workaround for me.

1 Answer 1

1

The timestamp "last modified" remains (and will not be replaced by the current time) when adding proper group and user IDs to the mount command, e.g.:

sudo mount -t cifs //mynas/folder mnt/mynas/folder -o user=username,gid=1000,uid=1000

You must log in to answer this question.

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