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

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

  • pitiable_sandwich540@feddit.org
    link
    fedilink
    arrow-up
    6
    ·
    1 day ago

    exfat or fat32 is great for interoperability between linux and windows but has limited functionality under linux.

    If you’re using your external drive only under linux, I suggest switching to a filesystem that works better with unix like permissions and special bits.

    Also, like others, depending on your use-case I would suggest something with journaling like ext3 or ext4. If you happen to power of your system while writing something to that drive, the fs does not get corrupted/can automatically recover.

    For backups with rollback maybe a FS with copy on write and automatic compression like btrfs or zfs would be better.

    With btrfs borg backups allows you to create incremental backups of btrfs subvolumes. I use it to backup my home, etc and /subvolumes on my “backup server” (old pc with two raid1 hdds).

    I have a friend who administeres backups for his company (afaik ~100-200GB delta per week) and he swears by zfs. I found btrfs simpler though.

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

      Hey pitiable_sandwich540

      Thank you

      I dont know why I have been so focussed and stuck on exFAT for all these years.

      It must have been something I read somewhere that led me to it.

      from all the decent feedback i have gotten on here, ext4 seems the best way to go.

      I should have known this being a linux user for over 20 years.