Prevent updates to 'modified time' when copying files to a mounted Samba folder

Fango

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:

  • 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” replaced with the current time!
  • But mounting a Samba folder is more convenient, also not all tools support the smb protocol. This is why using the URI smb:// is not a workaround for me.
marc

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]

編集
0

コメントを追加

0

関連記事

分類Dev

samba shared folder and mounted disk

分類Dev

Owner of mounted folder changes when it is actually mounted

分類Dev

Shutdown hangs when samba drive is mounted

分類Dev

how to tell rsync to preserve time stamp on files when source tree has a mounted point

分類Dev

Extracting (or copying) files to a compressed NTFS folder makes Windows report the disk is full when it's not

分類Dev

How can I store files in the mounted shared folder?

分類Dev

sudo: ./<SomeBinary>: command not found when run from mounted folder

分類Dev

Copying/sync'ing case sensitive files into a folder on Windows 10

分類Dev

find and remove all closed files that are not modified in some-time

分類Dev

Dismount a VHDx file mounted in a folder?

分類Dev

Copying a folder using xargs

分類Dev

Prevent duplicate updates

分類Dev

Cannot write to Samba shared folder

分類Dev

Ubuntu + latest samba version, symlinks no longer work on share mounted in windows

分類Dev

MSBuild not copying files with PublishProfile

分類Dev

copying files with gulp

分類Dev

directory changes permission when mounted

分類Dev

Terminal command vs. GUI drag & drop when copying large no. of files: Any tangible benefit?

分類Dev

Error Copying Typescript files when packaging Azure project - Visual Studio 2015 Update1

分類Dev

AppleScript / FolderAction - Rename files when dropped in folder > Endless Loop

分類Dev

Prevent user from copying text on mobile browsers

分類Dev

When updating mysql table row, current_time_stamp updates as well

分類Dev

Docker Run: Mounted Volume not showing change in files

分類Dev

Copying Thousands of Files on the same HD

分類Dev

Files get bigger while copying

分類Dev

Windows explorer crashes on copying files

分類Dev

git stash leaving modified files?

分類Dev

bitbake recipe for copying folder, subfolders for yocto

分類Dev

copying file of remote source to remote target folder

Related 関連記事

  1. 1

    samba shared folder and mounted disk

  2. 2

    Owner of mounted folder changes when it is actually mounted

  3. 3

    Shutdown hangs when samba drive is mounted

  4. 4

    how to tell rsync to preserve time stamp on files when source tree has a mounted point

  5. 5

    Extracting (or copying) files to a compressed NTFS folder makes Windows report the disk is full when it's not

  6. 6

    How can I store files in the mounted shared folder?

  7. 7

    sudo: ./<SomeBinary>: command not found when run from mounted folder

  8. 8

    Copying/sync'ing case sensitive files into a folder on Windows 10

  9. 9

    find and remove all closed files that are not modified in some-time

  10. 10

    Dismount a VHDx file mounted in a folder?

  11. 11

    Copying a folder using xargs

  12. 12

    Prevent duplicate updates

  13. 13

    Cannot write to Samba shared folder

  14. 14

    Ubuntu + latest samba version, symlinks no longer work on share mounted in windows

  15. 15

    MSBuild not copying files with PublishProfile

  16. 16

    copying files with gulp

  17. 17

    directory changes permission when mounted

  18. 18

    Terminal command vs. GUI drag & drop when copying large no. of files: Any tangible benefit?

  19. 19

    Error Copying Typescript files when packaging Azure project - Visual Studio 2015 Update1

  20. 20

    AppleScript / FolderAction - Rename files when dropped in folder > Endless Loop

  21. 21

    Prevent user from copying text on mobile browsers

  22. 22

    When updating mysql table row, current_time_stamp updates as well

  23. 23

    Docker Run: Mounted Volume not showing change in files

  24. 24

    Copying Thousands of Files on the same HD

  25. 25

    Files get bigger while copying

  26. 26

    Windows explorer crashes on copying files

  27. 27

    git stash leaving modified files?

  28. 28

    bitbake recipe for copying folder, subfolders for yocto

  29. 29

    copying file of remote source to remote target folder

ホットタグ

アーカイブ