Score:1

permission will not change on sd card file

au flag
j0h

I have a shell script I want to make executable on an SD card. I have changed the folder permissions to my user/group. no problems there. when I issue the command chmod a+x script.sh then check the permissions with ls -al the permissions are read only. I have tried sudo chmod +x script.sh and a variety of other chmod commands, yet the file remains read only. I tried marking the script executable, and copying it to the SD card. cp -p script.sh /media/a/4C00-1447/cosmo when I check the permissions, the script is back to being read only. I don't understand what is happening here. None of these commands return any errors. how can I put an executable script on my sd card?

Hi-Angel avatar
es flag
What is the file system on the SD card?
j0h avatar
au flag
j0h
Fat32 is the Filesystem
ar flag
The Fat32 does not support the Linux permissions you are trying to change. You will need to format the SD card to `ext4`.
Score:4
es flag

The FAT32 you're using on your SD-card does not support changing unix file permissions. All files will have exactly one permissions mask, which can be set when mounting FAT32 with umask= mount option. For example

 λ sudo mount /tmp/testfile mnt -o umask=000
 λ ll mnt/foo
-rwxrwxrwx 1 root root 0 ноя 30 23:40 mnt/foo

There is a workaround: format your SD-card as UDF filesystem (note that upon formatting your SD card you will lose any data previously stored on it). It is supported by most existing operating systems including Windows and Mac OS, and it also supports changing unix permissions of files, see:

 λ truncate -s 50M /tmp/testfile && mkfs.udf /tmp/testfile
 […]
 λ sudo mount testfile /tmp/mnt
 λ sudo chown -R $(id -u):$(id -g) /tmp/mnt/
 λ touch /tmp/mnt/foo
 λ ll /tmp/mnt/foo
-rw-r--r-- 1 constantine constantine 0 ноя 30 23:49 /tmp/mnt/foo
 λ chmod +x /tmp/mnt/foo
 λ ll /tmp/mnt/foo
-rwxr-xr-x 1 constantine constantine 0 ноя 30 23:49 /tmp/mnt/foo
ru flag
Note that formatting the card **will remove everything on the card currently** so if you do this you have to be careful. Also, if the SD card is not going to be used anywhere else, ext4 is still the most recommended for use with Linux.
Hi-Angel avatar
es flag
Good point, added a note about it
ar flag
You may have to install `udftools` as it is not installed in Ubuntu 22.04 by default.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.