Follow

Today I learned never to copy files over using an SD-card formatted (by default) with exfat. All file permissions of copied files set to 777 under Linux and macOS. Lots of fun.

One way of fixing it:

find . -type d -perm 777 -exec chmod 755 {} \;
find . -type f -perm 777 -exec chmod 644 {} \;

(And if you had any files that were meant to be executable, you’ll have to set their executable flags back with this method: chmod +x my_file)

@aral that's expected, FAT/VFAT/ExFAT have no concept of permissions like Unix systems :)

@Keltounet @aral And even NTFS and its derivatives insist on being bizarro :/

@aral If this is a junk SD, then I just write the tar directly🙂

like:
tar cvpf /dev/sd-dev some-dir-to-copy

@aral This may sound silly, but you can use dd to create an empty file within the existing SD card, then format the file, not the SD, to any filesystem you like, so long as preserves permissions. Then mount the file as if it were a device, copy your files into it, umount file, umount SD, plug it into the mac, mount, mount, then copy/paste with no worries.

@aral @aral I've been in that mess so many times.

the only difference being that it wasn't SD-cards, but anything portable with an exfat format.

I presumed that it was an exfat and just stayed away from it personally.

Then your friends brings similar problems to you.
You get so used to it that you can recognize the partition format when you look at the files' permissions 😹

@aral I usually copy like so (without < >):
tar cf - <src_dir> | (cd <target_dir> && tar xf -)

@aral Tar and similar archive formats exist because reasons.

(cfio, afio, if you must, ZIP)

You can also create loopback filesystems/images if you like.

Sign in to participate in the conversation
Aral’s Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!