recently I discovered on a text file copied per USB from my Pixel4a the execute bit was set automatically. I tried to read it by opening it from Caja but got the question if I want to execute it. By checking other files (like photos) after that I found out, that all files I transfer from the automatically "mounted" phone get there execute bit set.
I use Ubuntu MATE 22.04 LTS with the latest updates - and it looks like
Caja automatically a kind of mounts it via mtp/mtpfs (gvfs? - the device is reachable via '/run/user/1000/gvfs' as 'mtp:host=Google_Pixel_4a_17051JEC200361' too. The "mount" command doesn't show it.)
while I use on the phone the options:
MTP and the Android device handling the connection. (Changing the option to let the connected device handling the connection is not possible.)
Is there any help where I can change this default behavior so in the future nothing gets copied in a way it lands with an execute bit set on my PC. Maybe something similar to the mount option "file_mode=0644"?
...meanwhile I had the chance to connect my mobile via USB to a Xubuntu 22.04LTS PC and copying files to it showed the same effect. So it looks like the problem is not limited to Ubuntu MATE.
I read and tried and read and tried and read something else and they say it works only for new files not for files getting copied by cp. Maybe this is the reason the question in the stackoverflow-link isn't marked as solved. It looks like Caja and Thunar somehow use a similar method like cp and somehow assume every file on my android Google Pixel smartphone (automounted mtp/mtpfs) are having an execute bit set which they "preserve".
Thank you very much again.
I wonder if it only happens with my mobile phone...
Could maybe anyone with an Android smartphone try connecting it with the PC with an USB cable and copy some files via Caja and check the permissions of these copied files on the PC?
I'm still hoping on some feedback how this behaves with other peoples android phones connected by USB-cable. Meanwhile I found a kind of workaround for me:
I installed samba and changed in /etc/samba/smb.conf the one line to create mask = 0640
. I can't use the cable for this way but at least it works like it should be via wifi now.