Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Problem connecting to MacBook from Ubuntu linux over router-network

Hi!


On How to share files between Ubuntu and OSX? I found these apparently easy instructions on how to connect to my Mac from an Ubuntu PC:


"In mac OS, go to system preferences>sharing and enable "Personal File Sharing"


In Ubuntu open DashHome and open "Files" folder. (or however you know how to get to the files folder.)


In the sidebar, choose "Browse Network"


As long as the two machines are on the same network, your mac should

be in there as a directory that you can mount within Ubuntu."


On Ubuntu 20.04 I open Files (also called Nautilus) -> Other Locations -> I choose "MacBook Pro ..." under Networks. Then a window pops up asking for Username, Domain, Password. But no matter whether I use name and password for the Mac or Ubuntu it doesn't work. And what is "Domain"? I tried "Staff" (and "WORKGROUP"). Nothing works.


PS: The Mac is a MacBook Pro (13-inch, Mid 2012) running MacOS Catalina Ver. 10.15.7. It seems to be using SMB for networking.


Thank you.

MacBook Pro 13″, macOS 10.15

Posted on Apr 12, 2021 7:49 AM

Reply
Question marked as Best reply

Posted on Apr 15, 2021 5:42 AM

Well... first it didn't work:


xxx:~$ sudo  mount -v  -t  cifs  //macbook-pro-henrik.local/henrik  /mnt/macbook  -o  user="Henrik"
[sudo] password for henrik: 
Couldn't chdir to /mnt/macbook: No such file or directory
xxx:~$


But this solved it:


xxx:~$ cd /mnt
xxx:/mnt$ sudo mkdir macbook
xxx:/mnt$ sudo  mount -v  -t  cifs  //macbook-pro-henrik.local/henrik  /mnt/macbook  -o  user="Henrik"
Password for Henrik@//macbook-pro-henrik.local/henrik:  ***************      
mount.cifs kernel mount options: ip=192.168.1.227,unc=\\macbook-pro-henrik.local\henrik,user=Henrik,pass=********
xxx:/mnt$ 



Similar questions

20 replies
Question marked as Best reply

Apr 15, 2021 5:42 AM in response to HWTech

Well... first it didn't work:


xxx:~$ sudo  mount -v  -t  cifs  //macbook-pro-henrik.local/henrik  /mnt/macbook  -o  user="Henrik"
[sudo] password for henrik: 
Couldn't chdir to /mnt/macbook: No such file or directory
xxx:~$


But this solved it:


xxx:~$ cd /mnt
xxx:/mnt$ sudo mkdir macbook
xxx:/mnt$ sudo  mount -v  -t  cifs  //macbook-pro-henrik.local/henrik  /mnt/macbook  -o  user="Henrik"
Password for Henrik@//macbook-pro-henrik.local/henrik:  ***************      
mount.cifs kernel mount options: ip=192.168.1.227,unc=\\macbook-pro-henrik.local\henrik,user=Henrik,pass=********
xxx:/mnt$ 



Apr 15, 2021 8:45 AM in response to henrik-dk

The username provided in the dialog (typed at the Ubuntu console, but validated in the Mac) must have read-

/write permissions on the Mac to access those files.


Choose a typical file and choose GetInfo off the finder's File menu:


that bottom part of the box.

the top with a single person icon is the File Owner

The second with two people is the Group. Most successful sharing among a large number of Users is accomplished through Group permissions. You can create a new Group as easily as a new user.

The third is everyone or World.


The first or only user on a Mac is an Admin user (a member of the Admin Group).



Apr 12, 2021 5:20 PM in response to henrik-dk

You may have better luck trying to use the command line to mount the macOS share as it may include more information on the error when the connection attempt fails. Sometimes the Linux GUI apps make assumptions about the remote server that are incorrect so using the command line allows you to try other options more easily. Once you figure out how to connect using the command line, then you can attempt to see if the GUI app is able to configured in a similar manner.


henrik-dk wrote:

Then a window pops up asking for Username, Domain, Password. But no matter whether I use name and password for the Mac or Ubuntu it doesn't work. And what is "Domain"? I tried "Staff" (and "WORKGROUP"). Nothing works.

If a domain is configured on the host, then the domain information needs to be provided as well. Are you using the correct Mac user name & password that is part of the macOS share? I don't think it is necessary to supply a domain when connecting to a macOS SMB share.


PS: The Mac is a MacBook Pro (13-inch, Mid 2012) running MacOS Catalina Ver. 10.15.7. It seems to be using SMB for networking.

macOS does not allow AFP sharing when using the APFS file system. SMB shares are now the default for systems (or drive) using the APFS file system.


Do you have access to another Mac to test that you can connect to the share? Or even a Windows PC? Another Mac is best for testing although years ago I had trouble connecting one Mac to another one because they ran different major versions of macOS. I was unable to connect regardless which Mac was sharing the files. When you add in a non-Apple OS you can get the same issues as well since each OS implements SMB shares slightly differently and each OS (and even each app) has their own slightly different interpretations of the protocol and decent default settings.


Edit: Are both systems on the same subnet? Make sure to double check.

Apr 13, 2021 6:12 PM in response to henrik-dk

Both devices are most likely on the same subnet if they are both connected to Ethernet on the same router, but you would have to check & compare their IP addresses and check your router's network configuration.


You need to use the "mount" command with the "-t cifs" option which signifies an "SMB" share. You can use "man mount" and "man mount.cifs" to learn about the various options for "mount" with the latter being for the specific SMB options.

man  mount

man  mount.cifs


A sample of the most basic SMB mount command is in the format of:


SMB server with DNS name:

sudo  mount  -t  cifs  //<smb-server-dns-name>.local/<smb-shared-folder>   <local-mount-point>  -o  user=<macos-smb-user>


sudo  mount  -t  cifs  //<smb-server-dns-name>.local/<smb-shared-folder>   <local-mount-point>  -o  username=<macos-smb-user>


SMB server using IP address:

sudo  mount  -t  cifs  //<smb-server-IP-address>.local/<smb-shared-folder>   <local-mount-point>  -o  user=<macos-smb-user>


Replace "<smb-server-dns-name>" or "smb-server-IP-address>" with the SMB server's DNS name or IP address. I'm assuming you don't have a formal public DNS name for the Mac hence the ".local" after the DNS name to represent the local subnet. Using an IP address is safest until you confirm you can mount the share.


Replace "<smb-shared-folder>" with the actual folder being shared on the Mac. I'm not sure how macOS configures the SMB shares so I'm not certain how much of the path is required.


Replace "<local-mount-point> with your desired mount point for the share.


Replace "<macos-smb-user>" with a macOS user name/account with permission to the SMB share.


For example if your Mac's DNS name is "hwtechs-mac.local", the shared folder is "myshare", and the macOS user account name associated with the SMB share is "hwtech" you can use the following command:

sudo  mount  -t  cifs  //hwtechs-mac.local/myshare   /mnt  -o  user=hwtech


I haven't tried using Linux to mount a macOS SMB share in a while so I'm not sure if you will need to apply any other options to the mount command. I know that other options are sometimes required when mounting Windows SMB shares.


To use the "verbose" option to hopefully get more details on any mounting errors you would need to add the "--verbose" option after the mountpoint, but before the "-o " options like:

sudo  mount  -t  cifs  //hwtechs-mac.local/myshare   /mnt  --verbose  -o  user=hwtech


Don't forget to check your Sharing permissions on the Mac. The macOS Sharing section may provide some information such as the DNS name and IP address plus the path for the SMB share. I'm guessing macOS doesn't provide any "Domain" for the SMB share so using the basic command I have listed here will likely work. I also cannot connect to my Linux SMB share from the GUI most likely due to the forced "Domain" option. If you search online for using Linux to mount SMB shares you will get other examples (mostly for connecting to a Windows share, but it may still be relevant since it is very hard to find examples for connecting to a macOS SMB share).


Apr 14, 2021 12:03 PM in response to HWTech

OK! Thank you! I am getting nearer...:


First I got this error:


"mount: /mnt: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program."


Some searching revealed I needed this install:


$ sudo apt install cifs-utils


Then I got this error:


:~$ sudo  mount  -t  cifs  //macbook-pro-henrik.local/henrik  /mnt --verbose  -o  user="Henrik Rosenø"
[sudo] password for henrik: 
Password for Henrik Rosenø@//macbook-pro-henrik.local/henrik:  ***************      
mount.cifs kernel mount options: ip=192.168.1.227,unc=\\macbook-pro-henrik.local\henrik,user=Henrik Rosenø,pass=********
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)


(The 'mount.cifs' manual doesn't contain anything about a error(13))


But when I replace user="Henrik Rosenø" with user="Henrik" THEN it works... Except for the fact that it destroys the mounting of an essential NTFS partition... So I will have to post this, and then restart Ubuntu...



Apr 14, 2021 5:24 PM in response to henrik-dk

You can create a mount point anywhere that is convenient for you. By default I know that Debian mounts USB drives under the "/media" directory specifically "/media/<username>/<name-or-UUID-of-mounted-volume>". You can also create sub-directories under "/mnt" such as "/mnt/Mac-share" and "/mnt/NTFS-volume", etc. Or since you can customize your Linux install anyway you want you could create another directory on the root "/". You can even mount the share using a folder within your user folder. If you are going to have multiple mounted volumes, then having a parent folder with siblings for each specific mount point is the easiest way to manage them and keep them organized.


FYI, if you end up mounting two items at the same mount point such as "/mnt" you can unmount them you can unmount the last mounted item by using the command:

sudo  umount  /mnt


Which should allow you to see the data on from the original source mounted at "/mnt".


Apr 15, 2021 10:54 AM in response to henrik-dk

System Preferences > Sharing > File Sharing ...


... be certain sharing permissions are as you expect them to be.

You may have to add additional sharing permissions there.


--------

"special" as shown may indicate additional (Unix-like) permissions on that file.


You may need to use Terminal on the Mac or Ubuntu remotely to examine the nuances of that

Apr 15, 2021 11:14 AM in response to Grant Bennet-Alder

I do have read/write permissions on the particular file I am trying to overwrite. (And it has no 'special'.)

But do I need to unmount and remount the Mac on Ubuntu for 'something' to take effect?


I tried:


xxx:/mnt$ sudo umount mnt/macbook
[sudo] password for henrik: 
umount: mnt/macbook: no mount point specified.
xxx:/mnt$ 


EDIT: I should add, that NOW, after I set permissions again, the file no longer has the 'special' permissions!

Apr 15, 2021 5:45 PM in response to henrik-dk

henrik-dk wrote:

xxx:/mnt$ sudo umount mnt/macbook
[sudo] password for henrik:
umount: mnt/macbook: no mount point specified.

You forgot the initial "/" on the path which is why you got the "no mount point specified" error. Since you are already in the "/mnt" directory, these are your options:


xxx:/mnt$ sudo  umount  /mnt/macbook
xxx:/mnt$ sudo  umount  ./macbook
xxx:/mnt$ sudo  umount  macbook

Apr 16, 2021 3:03 AM in response to HWTech

HWTech wrote:

You forgot the initial "/" on the path which is why you got the "no mount point specified" error. Since you are already in the "/mnt" directory, these are your options:

xxx:/mnt$ sudo umount /mnt/macbook
xxx:/mnt$ sudo umount ./macbook
xxx:/mnt$ sudo umount macbook

Oops! Sorry!

Now I have unmounted it and mounted it again. But it makes no difference. I still cannot rename or overwrite a file in Documents on the Mac from Ubuntu. This is really annoying!


xxx:/mnt$ sudo umount /mnt/macbook
[sudo] password for henrik: 
xxx:/mnt$ sudo  mount -v  -t  cifs  //macbook-pro-henrik.local/henrik  /mnt/macbook  -o  user="Henrik"
Password for Henrik@//macbook-pro-henrik.local/henrik:  ***************      
mount.cifs kernel mount options: ip=192.168.1.227,unc=\\macbook-pro-henrik.local\henrik,user=Henrik,pass=********
xxx:/mnt$ 


Apr 16, 2021 6:11 AM in response to henrik-dk

This is getting worse and worse...


I suddenly discovered that I had lost writing permission at least on parts of my home folder... I haven't got the slightest clue about how on earth that happened...! I didn't choose that!!!


So in Finder I had to select my home folder (the house icon) -> Get Info -> Unlock -> Settings-icon (at the bottom) and then "Apply to sub-items" - my translation of the Danish "Anvend på underliggende emner...".


Now, at least, I seem to have recovered the usability of my MacBook...

I then unmounted it and remounted it on Ubuntu. But I still cannot write anything to the Mac from there.


So who decided to boycott who?... Apple or Ubuntu?...


I might add that Get Info on my home folder still says that I have "Special access", and I would like to show you a screenshot, but this forum does not allow me to insert it here...!

Luckily I have a website, so I have put it here: https://www.transformation.dk/deling/Screenshot-2021-04-16.jpg


Apr 16, 2021 4:54 PM in response to henrik-dk

If Ubuntu is mounting the share, then the problem is with the permissions on the Mac for the user account you are connecting with. In the examples you have posted that would appear to be "Henrik". I haven't done much file sharing from a Mac so I'm not sure macOS sets up the permissions and it has been a while since I set up SMB shares on my Linux server. The user that is being authenticated must have the proper permissions to that location including the parent folders as well. On Linux I had to manually configure those settings, but macOS should automatically do so, but I do know that macOS 10.15 had some permissions issues after I turned off File Sharing (couldn't write to items on the Desktop -- first time I ever encountered that issue just by turning File Sharing off).


Edit: I should clarify that the Ubuntu system (or any other system even macOS & Windows) does not have any control on the permissions of the SMB server. Your current issue is all macOS permissions issues on the SMB server.

Apr 17, 2021 7:04 AM in response to HWTech

Thank you for your reply!


You say that I have to have permissions on the parent folder/directory. That doesn't sound right. As far as I can tell, my home folder (the house icon) is inside a "Users" folder where only 'system' has write permission.


When I read your reply, it confirms to me, that Apple has a problem/error/bug in the file/folder Permissions system on MacOS Catalina 10.15.7.


Is the logical next step to contact Apple?


Problem connecting to MacBook from Ubuntu linux over router-network

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.