I don’t want the “last modified” attribute to be changed to the current date when copying files to a mounted Samba folder. How can I do this?
This behavior occurs with (K)Ubuntu 12.04 and Ubuntu 15.10. It can be reproduced using GUI browsers (tested with nautilus 3.4.2 and dolphin 2.0) and using cp -p
in 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:
smb://username@mynas/folder/
, then I can copy files to it without having the “modified time” replaced with the current time!smb://
is not a workaround for me.The command cp -P
doesn't apply to your needs. You are using uppercase argument letter -P
which is used to never follow symbolic links.
What you want to use is lowercase to preserve timestamps: cp -p
As described in the comment section of the question, using the correct gid and uid solved the problem:
sudo mount -t cifs //mynas/folder /home/mnt/nas/ -o user=username -o gid=1000,uid=1000
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加