4

I am using a MacBook running Mavericks and my brother is on a Linux box; and we often need to exchange files between each other. Both the laptops are Wi-Fi enabled and I also understand that Mac does allow file sharing over Wi-Fi. While I do know that Airdrop works only for Apple devices, I am sure there must be some way to share files with non-Apple devices using the built-in WiFi capabilities. Any suggestions around how? I have tried checking the file sharing option in the Preferences >> Sharing module but it didn't help. Is it possible to share files with a Linux user using SMB or AFP? I understand FTP is an option but connecting using FTP involves a lot of Terminal steps each time, i.e., activating FTP, sharing password with the user, connecting, and then closing FTP. Is there any simpler method?

Here are the steps I followed:

First of all I enabled guest sharing on my Mac:

enter image description here

Then I activated file sharing on my Mac and designated my Public folder as the share point (default).

enter image description here

Then I tried the following address on my Ubuntu's Nautilus:

smb://172.17.8.212/Public

It then asked for user name, domain, and password and I entered guest for all three, as advised by @deeviate. And this gave the following error:

enter image description here

P. S.: I am NOT interested in installing any third-party tool for this job. Mac gives SMB as a part of the OS and thats what I want to use. There might be tools out there that work better than SMB, doesn't matter. I still should be able to use SMB if my OS provides it natively!

12
  • Can you provide a bit more context and what your exact goals are? There are many different ways to get files from one computer to another, but context would help us get you a solution. Things like "I need to move files from OS X to Linux" or "I need to set up a folder on my Linux box that my Mac can dump files into whenever I need."
    – thankyour
    Commented May 6, 2014 at 15:18
  • Well, I want to be able to move files back and forth between my Mac and my brother's Linux over wifi. It would be great if we both could have a folder (something like a public folder) on our systems where we could dump files for each other. So, if I needed a file from my brother, he could dump that file into the public folder on my mac over wifi from where I could locally retrieve it. Conversely, if he needed a file from me, I could dump it into the public folder on his computer (Linux) for him to retrieve locally. Hope that helps...
    – TheLearner
    Commented May 6, 2014 at 15:22
  • 1
    @AmitSchandillia sorry for the late reply, i managed to replicate the issue between my mac and linux. yup the domain field is a frustrating one. I did manage to find a dirty solution. this is going to be a long post so i'm gonna break it up into multiple posts (i'll probably get flamed for this ...:P)
    – deeviate
    Commented May 14, 2014 at 16:43
  • 1
    on the mac: 1) go to systemprefs/user&groups 2) ensure that the listed guest account has "allow guests to connect to share folders" (you can uncheck the allow guest to logon to this computer) 3) go back to syspref main window and go to sharing 4) create a folder on your desktop (lets call it "dumpfolder") 5) create a new share and point it to "dumpfolder" you just created 6) Add "everyone" to the users pane and allow it "read&write"
    – deeviate
    Commented May 14, 2014 at 16:45
  • 1
    on the linux 1) open nautilus (or any other file managers) 2) type in "smb://<mac ip address>/dumpfolder/ and press enter when asked for user/domain/passsword - I used guest/guest/guest and got in. do try it and report back. its not the most secure solution but for the private sharing need at hand, this gets it done (hopefully). please remember to turn off the share on the mac when you are connecting to other networks.
    – deeviate
    Commented May 14, 2014 at 16:46

6 Answers 6

2
+50

regarding getting your SMB sharing connection from linux working...

Samba no more, mount.cifs needs extra options, "nounix,sec=ntlmssp"

Don't use the linux gui to connect, have bro open a terminal and try these commands

(and dig my ascii art!)


          =^..^=       `·.¸¸ ><((((º>.·´¯`·><((((º>   

amitsbrother@linux:~$ 
amitsbrother@linux:~$ sudo apt-get install cifs-utils
  ...
amitsbrother@linux:~$ mkdir /mnt/mavericks_smb
amitsbrother@linux:~$ mount.cifs //172.17.8.212/smb_share /mnt/mavericks_smb/ -o user=amitsbrother,password=trustno1,nounix,sec=ntlmssp
amitsbrother@linux:~$ 
amitsbrother@linux:~$ mkdir /mnt/mavericks_smb_dup
amitsbrother@linux:~$ mount -t cifs //172.17.8.212/smb_share /mnt/mavericks_smb-dup -o username=amitsbrother,password=trustno1,nounix,sec=ntlmssp

Once this is working, you can create a script for your brother to automatically mount when it is executed from the gui. Basically, the script is just the mount point creation, and the cifs connection to the smb server... so 2 or 3 lines including the shebang.


Make sharing work now with no passwords

To make it super simple, I'd enable web sharing on the Mac, and put the files you want to share to the Linux box in a folder in ~/Sites/a_folder/ . Then give your brother the address that it tells is your personal web sharing address in the Sharing Preferences pane when you enabled Web Sharing. Tell your brother to open a browser and put in that address; it will give him a directory listing as long as there is no index.html file in there. He can download files with his browser. This is one way sharing, from the Mac to the linux box, and will work fine as long as there are no files over 4GB (unless apache fixed that issue and didn't tell me about it). I believe directory listing is enabled by default on the Mac apache2 server.

To share in the other direction, from linux to Mac, you could do the same from the Linux box:

 sudo apt-get install apache2

You can enable directory listings on the Linux apache2 server with instructions here. Those instructions inadvertantly also cover how to get the apache2 server up and running. Then you need the ip address of the Linux box, and the relative location from the apache root to see the files in your Mac's browser.

This shouldn't take 5 minutes to set up 2 x 1-way sharing through browsers on both boxes, and relieves you from hacing to trouble-shoot the slightly more complex task of installing and configuring netatalk or running SMB sharing from the mac and getting the linux client to mount it, which isn't always a "it just works" situation, like running 2 apache2 servers is.

8
  • Alas, I was hoping to be able to use SMB for once! I am already using FTP (running an Automator shell script of my own that checks if FTP is on and toggles it on/off accordingly on my Mac) which seems the simplest solution to me. However, what had been nagging me was why I couldn't use SMB if it works for everyone else! But thanks for your advice. :(
    – TheLearner
    Commented May 17, 2014 at 2:25
  • @AmitSchandillia - The idea here is this is not necessarily a permanent set up, just one that will work immediately, while you work on troubleshooting why SMB doesn't work. Sounded to me like there was some urgency.
    – chillin
    Commented May 17, 2014 at 2:39
  • Well, yes there is an urgency and that is of the bounty on this question expiring today without a working solution around SMB. Otherwise, like I said, I am already using FTP and it's working fine. Just peeved about "SMB" not working despite being available on Mac as a native support. I had assumed it would "just work" as Apple claims for everything it does.
    – TheLearner
    Commented May 17, 2014 at 2:48
  • @AmitSchandillia - ah, now I understand, and, with SMB, I understand. Apple no longer uses Samba, and I'm not sure if that's the problem or not, but in my experience, the "just works" promise only really applies to Macs. Apple doesn't support Linux, and hardly supports Windows, but because its a "Windows World" has much better Windows support.
    – chillin
    Commented May 17, 2014 at 2:52
  • Really! I thought if SMB is provided under "File Sharing" on my MacBook, it would work regardless of who is connecting with me, Linux, Mac, or Windows. So, you mean another Mac user attempting to connect with me over SMB would be able to connect while a Linux user might not be that lucky? In that case SMB seems redundant to me since Mac-Mac transfers are already possible using AirDrop. :(
    – TheLearner
    Commented May 17, 2014 at 2:55
6

Thought I threw my two cents in.

Being both a Mac and Linux user - I find that once a SAMBA share is created on a Linux machine (browseable option on Linux samba turned on with or without a login - you can "connect as" from the Mac to the Linux machine), my Mac would pick it up and list in on Finder's left pane. Here's a quick SAMBA setup for the Linux machine.

Its pretty simple to setup a public share folder (or even a private one) on the Mac. Here's one guide

2
  • 1
    Also possible from Linux to get it done using SSH. In the Mac System Preferences > Sharing enable "Remote Login"...
    – llange
    Commented May 14, 2014 at 11:05
  • Please review the screen shots in my question. I want to let the Linux machine connect to my Mac using SMB and none of the methods outlined thus far seem to be working. Please advise before the bounty closes!
    – TheLearner
    Commented May 17, 2014 at 0:04
4

With the Mac hosting the share point, here's what you need to do. I can provide basic instruction to connect from your Linux box to the Mac, but you'll have to research your particular distro if you run into any issues:

  1. Like YoshiBotX said, turn on "File Sharing" in System Preferences > Sharing.
  2. By default, you should see your own Public folder already populated under the Shared Folders section. Per your comment to your post, leave that unchanged.
  3. Under the Users section, toggle the permissions as you see fit.
  4. Click the Options button above the Users section and enable "Share files and folders using SMB." This is the Mac's SAMBA. Click Done.
  5. If you're on the ad-hoc network you created, discover your "router" (the computer hosting the network) IP address. How you do this depends on the Linux distro you're running.
  6. Make a "share point" folder on your Linux unit, possibly with mkdir <some path>. Not sure if this is required in Linux, but I do it on my Mac (Darwin) and bash.
  7. Assuming SMB/SAMBA is installed and configured on your Linux computer, connect to the shared folder via command line: smb://<router-ip-address>/Users/<mac-username>/Public/ /<path>/<to>/<share-point>/.
  8. The public folder should then be mounted on your Linux computer and available for read/write.

I don't play around with Linux much, but hopefully this will get you started. There's a really good Ubuntu StackExchange if you have questions..and you're using Ubuntu. ;)

7
  • On Linux, it's asking for some port number and domain. What should I enter there? All I have on my Mac is an IP address, a username, and a password. Where can I find the domain name and the port number?
    – TheLearner
    Commented May 9, 2014 at 12:44
  • Please disregard the comment above. Here's the updated one: On Linux, it's asking for a domain. All I have on my Mac is an IP address, a username, and a password. Where can I find the domain name? Do note that I tried the default domain name (WORKGROUP) with no success.
    – TheLearner
    Commented May 9, 2014 at 13:10
  • try using your macs IP address for domain
    – deeviate
    Commented May 9, 2014 at 18:41
  • @deeviate No luck :(
    – TheLearner
    Commented May 10, 2014 at 14:15
  • In the Sharing Panel, you also have the name of your machine, for example "Tom's MacBook Air". So the domain+login could be (but does not neccessarily needs to be) : Toms-MacBookAir\Tom
    – rwenz3l
    Commented May 11, 2014 at 15:36
2

Netatalk 3

Use Mac style file sharing for less freezes with huge files.

Why Netatalk?

This solution is not my first try between MacOSXes and Linux server. Here is a small review about the available solutions for this:

  • NFS: The MacOSX use very old version (v1), what not supported any authentication (login or token) solutions
  • Samba2: MacOSX 10.7-10.9 versions and Samba or Ubuntu Precise are semi-compatible. Connection drops with huge files transfers and lot of small file transfers (and freezes Mac clients...). I have tried lot of performance tuning, changed hardware, but there weren't solutions.
  • Netatalk3: It is the smaller bad. The connection always OK, but can't use multi-core at server side... However, you can use TimeMachine!

Install steps

Sources:

Thank you!

1. Install dependencies

apt-get install automake libtool build-essential pkg-config checkinstall git-core avahi-daemon libavahi-client-dev libdb5.1-dev db-util db5.1-util libgcrypt11 libgcrypt11-dev

2. Download and unpack source

cd /usr/src/
wget http://prdownloads.sourceforge.net/netatalk/netatalk-3.1.1.tar.gz
tar -xvzf netatalk-3.1.1.tar.gz

You can use other versions: http://sourceforge.net/projects/netatalk/files/netatalk

3. Configure

cd netatalk-3.1.1
./configure --with-init-style=debian --with-zeroconf

4. Build

make

5. Make DEB & install

sudo checkinstall

6. Configure daemon

Here is a minimal configuration that shares home directories only. You'll want to take a look at the official documentation for more elaborate environments.

/usr/local/etc/afp.conf

;
; Netatalk 3.x configuration file
;

[Global]
mimic model = RackMac

[Homes]
basedir regex = /home

; [My AFP Volume]
; path = /path/to/volume

7. Start services

sudo /etc/init.d/netatalk start
4
  • I am not interested in installing any third-party solution. I just want to be able to perform file transfers between a Mac and Linux using SAMBA which is already built into both the operating systems. I don't want to be installing third-party scripts/apps for every little thing that I need to do, especially if the capability is already built into the OS!
    – TheLearner
    Commented May 13, 2014 at 1:56
  • @AmitSchandillia: I extended my original post with a review about available techniques.
    – andras.tim
    Commented May 13, 2014 at 10:43
  • @andras.tim - that is a nice rundown! Just curious, if netatalk3 isn't in the default repositories for ubuntu (which is crazay that its not if true), isn't there a trusted source somewhere to add to the sources list, so the user doesn't have to track and install dependencies?
    – chillin
    Commented May 17, 2014 at 2:40
  • @chillin I changed the installation steps for make DEB file and better tracking.
    – andras.tim
    Commented Jun 17, 2014 at 22:12
0

As I READ you want to be able to simply share files,
you can do so via the Sharing Preference Pane:
Go To Settings -> Sharing -> File Sharing -> Options ->
"Share via SMB [On]" and "Share via AFP [On]".
-> Add a Folder and -> Check the Box next to "File Sharing" to activate the Service.

BUT:

I THINK you want to share files without having a router in between the two laptops, so they are basically in an Ad-Hoc Network (Because you mentioned AirDrop).
If that assumption is correct, you can do so:
Clicking on the Wireless Icon in your Menu Bar and choose "Create Network".
After you have done that, you can go on with the steps above.

1
  • 1
    Thanks for your response but could you please break it down further for me? I (on a Mac) and my brother (on Linux-Ubuntu) are already connected via an ad-hoc network through Internet Sharing. I am hooked up to the Internet via ethernet and my brother is connected to me via a WiFi bridge (ad-hoc) connection. However, he is still unable to share files with me.
    – TheLearner
    Commented May 5, 2014 at 23:22
-1

I'd say install software specifically for this task so you can easily choose when sharing is active. (Just like turning on airdrop.)

The SMB or NFS route means you're running a server on one of the machines. If one of these is a laptop, that can be a pain to remember to disable the service when you roam on to public networks. Its easy to get wrong.

Something like Retroshare or Nullsoft WASTE would do the job. Retroshare is a FOSS p2p client for mac and linux. http://retroshare.sourceforge.net/downloads.html

You can set a folder to 'share' and its available to folks you chose to share it with minimal configuration.

2
  • The no external software requirement was added after I posted my answer. There's no reason for a down vote. My solution is simple and has a predicable outcome and is accessible for your average joe.
    – txyoji
    Commented May 21, 2014 at 4:07
  • I do not know why someone downvote's but RetroShare might have some security issues specialmeaning.blogspot.com/2016/09/… Maybe because its slow? Commented Oct 11, 2016 at 18:35

You must log in to answer this question.

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