File permissions change when transfering between external drives and laptop

I noticed a few years ago that when I transfer files back and forth between my laptop and my external drive all the files that I have transfered have changed permissions.

I format all my external drives as exFAT so I can use larger files.

Why does this happen?

Is there a better way to keep the file permissions intact when transfering files back and forth between external drives?

The test file: Fantastic Fungi (2019).mkv

+++++++++++++++++++++++++++++++++++++++++++++++++++

This is what the file permssions looks like before I transfer it to my external hard drive

ls -l

-rw-r–r-- 1 user user 577761580 May 2 2024 ‘Fantastic Fungi (2019).mkv’

+++++++++++++++++++++++++++++++++++++++++++++++++++

This is what the file permssions looks like after I transfer it back to my laptop

ls -l

-rwxr-xr-x 1 user user 577761580 May 2 2024 ‘Fantastic Fungi (2019).mkv’

When I right click file permissions dialogue box. The “Allow this file to run as a program” is ticked.

+++++++++++++++++++++++++++++++++++++++++++++++++++

The way have overcome this is to run a simple one liner to reset the permissions for directories and files.

Open a terminal in the directory of the folders and files you want to change

All directories will be 775. All files will be 664

find . -type d -exec chmod 0755 {} ;

find . -type f -exec chmod 0644 {} ;

Directory permission 0755 is similar to “drwxr-xr-x”

File permission 0644 is equal to “-rw-r–-r–-“.

-type d = directories

-type f = files

+++++++++++++++++++++++++++++++++++++++++++++++++++

  • SteveTech@programming.dev
    link
    fedilink
    English
    arrow-up
    2
    ·
    16 hours ago

    If it’s an external SSD, I like to format my drives as f2fs, which is a filesystem designed for flash memory, so it might be a bit faster and last longer than ext4. But that’s just personal preference and ext4 should always work fine.

    • infjarchninja@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      4 hours ago

      Hey SteveTech

      I dont use internal or external SSD’s.

      It maybe because I am an old greybeard, but I prefer to suffer the slight loss in speed of a HDD, so I can dd/erase/wipe them and reuse them again and again.

      Though I have been using “disktest” to erase SSD’s and HDD’s recently and it has been working great. Much faster than zeroing with dd /dev/zero, shred or wipe.

      https://crates.io/crates/disktest

      https://github.com/mbuesch/disktest

      However, I digress, I had not heard of f2fs before.

      Ive been having an intersting read online.

      It appears that it is a default for android phones.

      I do have a few SSD’s laying around from when I replace them with HDD’s. So I will test f2fs on one of those.

      Thank you