0

I'm not sure if this is the best Stack Exchange to use, but the question concerns Mac, Linux and Samba.

I have a new-to-me Apple Macintosh laptop (MacOS 10.15.7 (Catalina)) and I am have set up Samba (fairly standard changes to /etc/samba/smb.conf) to make files on my Ubuntu Mate (UM) laptop available to my Mac. There are no Windows machines in my network.

Copying files from UM to the Mac works. However I have a lot of documents on UM which do not have extensions. If these files are plain text files, then on arrival at the Mac they are treated as executable programs.

(Other file types such as png are treated correctly whether they have an extension or not.)

For example, I have two text files in a folder called test on the UM. The command ls gives:

$ ls -al
total 16
drwxrwxr-x 2 bob bob 4096 May 12 22:23 .
drwxr-xr-x 3 bob bob 4096 May 12 22:22 ..
-rw-rw-r-- 1 bob bob   24 May 12 22:23 test file
-rw-rw-r-- 1 bob bob   24 May 12 22:23 test file.txt

Properties show "Allow executing file as program" is off and SELinux context: unknown

On Mac after copying from UM:

% ls -al
total 16
drwxr-xr-x  4 bob  staff  128 May 13 00:23 .
drwxr-xr-x  7 bob  staff  224 May 13 00:23 ..
-rwx------  1 bob  staff   24 May 12 22:23 test file
-rwx------@ 1 bob  staff   24 May 12 22:23 test file.txt

Get Info on "test file" says it is Unix executable; double-clicking on it (in Finder) fails in a new terminal window. Get Info on "test file.txt" says it is Plain Text Document; double-clicking on it opens it in TextEdit.

I can open "test file" in TextEdit by right-clicking the file, choosing "Open with..." and finding the TextEdit application, but this is a little tedious.

Are there any downsides to specifying always open executables in TextEdit? Alternatively, is there a way to automatically make the Mac know that these files arriving from Samba are Plain Text?

5
  • Does this help? Maybe you need to set this on your Mac? serverfault.com/questions/158536/…
    – jimtut
    Commented May 13, 2021 at 1:34
  • @jimtut I'm not sure. You mean find the smb.conf file on the Mac and edit that? Also, I'm not sure it is to do with permissions. The two files that arrive on the Mac have identical permissions, but one works as hoped for and the other not. P.S. To be precise, one file has an "@" and the other not, but when I looked at them this morning, they both had acquired an @. Commented May 13, 2021 at 12:25
  • Oh, I thought you were worried about the executable permissions, which I think you can fix in that smb.conf file. That @ symbol indicates that there are extended permissions or ACL‘s on that file, I think, but I’m not sure that’s a problem, it’s normal on a Mac.
    – jimtut
    Commented May 13, 2021 at 12:37
  • @jimtut Giving the command "ls -l@" shows that the .txt file has an attribute "com.apple.macl 72" which the other file does not have. So, I need to research why the Mac gave it that attribute. Commented May 13, 2021 at 16:21
  • @jimtut Well, I've set up the Mac to always open files of type "Unix executable" in TextEdit. If I chmod the file to remove the execute permission, then the file icon changes from a picture of a terminal window to a plain blank icon, and the filetype becomes "TextEdit" (not "Plain Text"). That would be OK for me. So all I need now is to find a way to stop Samba/Mac giving my files execute permissions when they arrive on the Mac. Commented May 13, 2021 at 17:14

1 Answer 1

1

I found a way to automatically make the Mac know that these files arriving from Samba are Plain Text. The wiki entry https://wiki.samba.org/index.php/Configure_Samba_to_Work_Better_with_Mac_OS_X recommends adding the following lines of code to the /etc/samba/smb.conf file on the Ubuntu Mate machine. (Followed by $ sudo service smbd restart) The lines are inserted at the beginning of the [global] section.

min protocol = SMB2
vfs objects = fruit streams_xattr  
fruit:metadata = stream
fruit:model = MacSamba
fruit:posix_rename = yes 
fruit:veto_appledouble = no
fruit:wipe_intentionally_left_blank_rfork = yes 
fruit:delete_empty_adfiles = yes 

I understand almost nothing of this but it seems to work. When the files arrive at the Mac, they have the same permissions as the originals. The .txt file has Finder Kind "Plain Text" and text files without an extension have Kind "TextEdit".

(I had previously set up the Mac to always open files of type "Unix executable" with TextEdit. I don't know if that makes any difference.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .