You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

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

can smb and afp coexist on the same host?

Greetings all!


I've been using Macs and OSX for a year. And recently I bought another MBP so I am seriously considering Time Machine backups. I have a Linux home server running Ubuntu 12.04 and Samba and my previous MBP running Mountain Lion connects to it happily without any problem. But my trouble started when I tried to setup afp on the same box.


I followed this post and this post and got the fake time capsule showing in Time Machine without any problem. But soon I found myself unable to connect to the old samba shares. The smb host now displays as a Time Capsule. If I click on that OSX will say 'failed to connect'.


As I understand there are 2 pieces involved on the server side, avahi to broadcast the service info and netatalk to provide the service itself. It's a bit like nmbd and smbd in Samba. If this is true then it's somewhat understandable that OSX can not display the same host as 2 different types of services at the same time. So I stopped avahi-daemon and very soon the old Samba shares appeared again.


I am able to connect to both services using command+k but I would rather have them running normally so that my wife will be able to use them without extra tech support. Can anyone tell me if what I said above is true and/or if there is a graceful way around this? If answer is no then I will have to create a virtual machine or nic alias just for time machine and I think it's quite a waste.


Thanks!

MacBook Pro with Retina display, OS X Mountain Lion (10.8.5)

Posted on Dec 18, 2013 3:16 PM

Reply
14 replies

Dec 18, 2013 4:30 PM in response to etresoft

Thanks for your reply!


And can I ask why I don't want to backup to netatalk?


If you mean going by smb there is a downside and that's said to be one of the reasons why Apple is trying to force users to use real Time Capusule in recent OSX releases(in older ones Time Machine was OK with SMB). Although SMB has better performance over afp it does not force fsync and hence can not guarantee journals are written to the actual file system before comitting changes. And if there happens to be a power failure or system crash, you'll end up with corrupted backups and that's probably the last thing you want with backups.


With regard to whether Linux can run these 2 protocols I am pretty sure the answer is yes and I don't need support on that. The reason why I ask in Apple forum is that this seems to be rather an issue with OSX. If you compare it to Windows, it groups networks by protocols and perhaps will never have this issue.

Dec 18, 2013 5:01 PM in response to tristonej

tristonej wrote:


And can I ask why I don't want to backup to netatalk?


.... you'll end up with corrupted backups and that's probably the last thing you want with backups.

That's why. Netatalk is just a really bad piece of software. These forums are littered with people who buy various NAS devices expecting to do Time Machine backups only to discover that it doesn't work. Supposedly, Netatalk reached compatibility with OS X 10.2 in 2009, but when Lion finally disabled cleartext autentication, people discovered that their version of Netatalk wasn't even that recent. Do you want to backup your data to a server that may or may not support the latest OS X network file system circa 2002?


Time Machine still requires AFP. Maybe it will support SMB2 one day. You are welcome to experiment with your backups if you so desire.


With regard to whether Linux can run these 2 protocols I am pretty sure the answer is yes and I don't need support on that. The reason why I ask in Apple forum is that this seems to be rather an issue with OSX. If you compare it to Windows, it groups networks by protocols and perhaps will never have this issue.

Bonjour supports any number of services and service types on the same host. If it can't see multiple services on a Linux host, then it is Linux that is broken. Bonjour is not standard on Linux. You would probably have to recompile some of your Linux software to support it. However, the problem might be with Samba itself. Mavericks is designed to use SMB2 to communicate with other Mavericks machines by default. I am sure it is also designed to work properly with Windows networks. I would be surprised if Apple even bothered with Samba. Each Linux server is essentially a unique operating system that exists nowhere else.


My question to you would be why run Linux when you have Macs? A Mac can do anything a Linux server can do, and a whole lot easier. The last time I setup a Linux server from scratch, maybe 3 months ago, I still had edit the source code of major open source libraries just to get it to compile. I guess the Netatalk thing make sense. With Linux, one is in a perpetual 2002.

Dec 18, 2013 6:34 PM in response to etresoft


etresoft wrote:


That's why. Netatalk is just a really bad piece of software.

Maybe I did not make myself clear nough. Netatalk *solves* that problem, not introduces it. The fsync issue is with the smb protocol. To get performance, you have to trade off something. And on the other hand, AppleTalk has its strength and weaknesses as well.


These forums are littered with people who buy various NAS devices expecting to do Time Machine backups only to discover that it doesn't work. Supposedly, Netatalk reached compatibility with OS X 10.2 in 2009, but when Lion finally disabled cleartext autentication, people discovered that their version of Netatalk wasn't even that recent. Do you want to backup your data to a server that may or may not support the latest OS X network file system circa 2002?



I don't quite understand why people buying non-Apple devices should not expect OSX to work with them, even when OSX is running on Apple hardware. I did consider buying a mac mini as a server but later gave up and chose to build one of my own. I spent a lot more money but I get what I exactly need. There is a time when apple only worked with apple but that aparently was not sustainable. And that's why now Apple is embracing smb(it's said even samba was used shortly on OSX, not quite sure) and allow users to install windows on macs. Even OSX itselt is based on FreeBSD and uses quite a lot of open source components.


IMHO there is no magic in throwing money at propiretary hardware/software or praying to Steve Jobs. If something is not working, it must be that there is a bug in the code or the design. And neither OSX nor Macs are built by God, which means they are bugged as other software/hardware.


My question to you would be why run Linux when you have Macs? A Mac can do anything a Linux server can do, and a whole lot easier. The last time I setup a Linux server from scratch, maybe 3 months ago, I still had edit the source code of major open source libraries just to get it to compile. I guess the Netatalk thing make sense. With Linux, one is in a perpetual 2002.


The answer is simple, Macs can not do what I want.


Withe a standard mATX case I can have quite a few 3.5" drive bays while there is only one 2.5" in a Mac mini. And with Ubuntu/Debian, getting/updating the software or the system is quite easy, just one or a few lines of apt commands, not quite possible with OSX. If you must compile something from the source to get a Linux running then something must be seriously wrong.


The best thing I love about Linux is openess. You can customize almost everything and change it whatever way you want. With Mac, for example the 2013 Retina MBP I just bought, it's not even possible to change the power button behavior, which is very annoying.



Back to my original question. I think the problem is not quite with compatibility of Bonjor but rather whether OSX can show this or not. Imagine you have a smb share and afp share on the same host, with the same name, how would OSX display it? And which icon will OSX use to display the host? I can not think of the answer so if you know please tell me.

Dec 18, 2013 7:39 PM in response to tristonej

tristonej wrote:

I don't quite understand why people buying non-Apple devices should not expect OSX to work with them

Because Apple has no control over 3rd parties. They can do what they want. If Apple publishes a new authentication mechanism in 2002, the 3rd party doesn't have to implement it. That isn't Apple's fault. If they do get around to supporting it in 2009 and then some 4th party doesn't bother to use the 2009 code in 2011, Apple still can't do anything about that. If anyone else wants to advertise, and support, Time Machine compatibility, they are welcome to do that. They definitely have the advertising part down, the support, not so much.

There is a time when apple only worked with apple but that aparently was not sustainable. And that's why now Apple is embracing smb

Apple's goal is to choose the best solution for its customers. Sometimes that is a proprietary connection or protocol and sometimes it is something industry standard. In all cases, there has to be some cut off for testing and support. That is why Apple eventually stops supporting its own hardware and technologies at a certain point. That is also why Apple will support SMB as deployed by Microsoft but isn't going to waste much time on home-built Linux servers.


(it's said even samba was used shortly on OSX, not quite sure) and allow users to install windows on macs. Even OSX itselt is based on FreeBSD and uses quite a lot of open source components.

Apple uses a lot of open source software. Samba was one of those projects. Unfortunately, the people that made those products didn't want Apple using them so they changed the licensing to prohibit Apple (and pretty much only Apple) from using their source code. That is why some of the open source packages in OS X are stuck in a 2007 version. That is also why Apple abandonned Samba and wrote its own SMB implementation.


OS X is not based on FreeBSD. It has a BSD-flavoured POSIX layer, but it is a distinct operating system at its core.


IMHO there is no magic in throwing money at propiretary hardware/software or praying to Steve Jobs. If something is not working, it must be that there is a bug in the code or the design. And neither OSX nor Macs are built by God, which means they are bugged as other software/hardware.

I'm confused. When did anyone say anything about praying to Steve Jobs or divine technology? You asked about using Linux as a Time Machine server. I suggested you avoid that if you value your data. I also asked why you would want to keep running Linux now that you have a Mac. A Mac can do anything Linux can do with a fraction of the effort.


The answer is simple, Macs can not do what I want.

Which is?


Withe a standard mATX case I can have quite a few 3.5" drive bays while there is only one 2.5" in a Mac mini. And with Ubuntu/Debian, getting/updating the software or the system is quite easy, just one or a few lines of apt commands, not quite possible with OSX.

That's certainly true. OS X updates itself without having to run any apt commands.


If you must compile something from the source to get a Linux running then something must be seriously wrong.

My thoughts exactly. But perhaps you didn't follow me entirely. Apt, yum, etc don't have everything one needs to setup something as fancy as, I don't know, a web server. While I did have to compile a number of things from source, I had to actually edit the source a couple of times as well.


The best thing I love about Linux is openess. You can customize almost everything and change it whatever way you want. With Mac, for example the 2013 Retina MBP I just bought, it's not even possible to change the power button behavior, which is very annoying.

Then why did you buy a Mac? That's no big secret. Some people like not have to configure everything just to get it running. I have other things to do than edit config files.


Back to my original question. I think the problem is not quite with compatibility of Bonjor but rather whether OSX can show this or not. Imagine you have a smb share and afp share on the same host, with the same name, how would OSX display it? And which icon will OSX use to display the host? I can not think of the answer so if you know please tell me.

OS X will just display it like it display any server. One of your links event has instructions on how to pick the icon you want to fake. If you are running both services then I am not sure which one it would try to connect with. Neither of your services are native, not matter how much they try to fake it. If you wanted a specific service you would have to manually use the correct protocol in Finder > Go > Connect to Server. However, bot of those links were posted before Mavericks. Obviously they don't work anymore. It's Linux. It's open. Right? So fix it and post it on your own blog. I do not know what modifications you would have to make to either Samba or Netatalk to make them work with Mavericks.


If all you need is to allow your wife to connect to one specific protocol, then manually connect to that service, saving your password in the keychain, and create an alias by Command-option dragging the server to some other folder. Then, she can just double-click on the alias to connect to the network.


Now, if you really want to be clever, you can setup an automount to that service instead. Then the server will be mounted and unmounted as needed.

Dec 22, 2013 7:47 PM in response to etresoft

Hi,


I think I solved this issue after a couple of hours. Though not sure, it's much likely OSX can not display smb and afp shares under the same host. It should be easily verifieable by installing a virtual machine software and create a windows guest in OSX, and then NAT the netbios ports.


The changes are mostly in avahi.


  • In /etc/avahi/avahi-daemon.conf, uncomment and set the host-name to whatever you like. Make sure it's different than your samba hostname.
  • In /etc/avahi/hosts, add one line like below, assuming your afp hostname is "tm" and IP address is 192.168.1.10.
    192.168.1.10 tm.local
  • Just to be safe, in /etc/netatalk/afpd.conf, change your server configure line by prepending the hostname "tm" so that it looks something like
    tm - -tcp -uma_guest.so ...
  • Reboot avahi
    service avahi-daemon restart
  • Reboot netatalk
    service netatalk restart
  • And your're done.


I have found the syslog in /var/log/syslog been quite handy diagnosing avahi/netatlk problems. Also the avahi-* commands are quite useful in verifying your configuration works.


avahi-browse -a


will show you all currently published mDNS entries.




To etresoft,


Thanks for all of your instructions anyway. Though they are not quite what I needed.


I surely know how to change the icon, or connect to a networkshare(I already put 'Command+K' did't I). My question was when OSX is supposed to show a Windows and TimeCapsule icon for the same host what it will do.


In fact even when OSX was not able to display the icon, I still could use both types of shares without any problem. The reason why I asked is I believed there is a way to make it work just like an Apple device does, since there is no magic in Apple devices. And when I do, it will be as easy to use as an Apple device is.


And you are seriously wrong about the "3rd party not Apple's" falut part. There is something called standard. Apple does not build wall socket, while you still can expect to plug your Apple devices into them without trouble. Why? The name resolution standards, be it netbios, or mDNS, are both standards, though mDNS is mostly used by Apple. If Apple follows standards, and avahi follows standards, there is no way they don't work together. Simple as that.


Regarding your "why you buy Apple" question, that's because I've got a little extra cash to burn and Apple is pricy enough to burn it. Besides Apple does have a good balanced combination of quality hardware/software and is quite pleasant to use most of the time. But it never was because I wanted to outsource my thinking to Apple. If I was forced to choose between Apple without brain or brain without Apple, I would not hesitate for a second about it.


Your experience with Linux was rather strange, I must say. Most of the Linux distros have the LAMP(Linux, Apache, MySQL, PHP) stack working out of the box. From the first time you boot you can point browser to 127.0.0.1 and get a web page saying something like "It Works!". Even if for some reasons you did not choose to install them the first time, you can either add later either using one line of command, or using GUI, which is just as easy as using AppStore. What AppStore can never do though, is to retrieve the source code and compile it for your in just a few lines of commands. And can it update software not installed from AppStore? Well Linux can.


Well it's almost Christmas. Wish you have a nice holiday 🙂

Dec 22, 2013 8:14 PM in response to tristonej

tristonej wrote:


....


And you are seriously wrong about the "3rd party not Apple's" falut part.

Oh really? I suggest you re-read your own post 🙂


If Apple follows standards, and avahi follows standards, there is no way they don't work together. Simple as that.

I think you misunderstand standards. I see no evidence that OS X, or even Linux in this case, was doing anything wrong. It seems that you expected it to do something that it never claimed to do and is not part of any one standard.


But it never was because I wanted to outsource my thinking to Apple.

It isn't a question of outsourcing. It is a question of value and return on cognitive investment. A Mac can do anything that Linux can do, but infinitely easier. Choosing to make something more difficult for yourself is not the opposite of outsourcing. There are people who enjoy tinkering with config files and rebuilding software components. There is nothing wrong with that and Linux is a great choice in that case. But it is important to be honest about why one makes technical decisions. If you like technical puzzles and tinkering, just admit it. It is not a vice. There is no need to justify it.


Your experience with Linux was rather strange, I must say. Most of the Linux distros have the LAMP(Linux, Apache, MySQL, PHP) stack working out of the box. From the first time you boot you can point browser to 127.0.0.1 and get a web page saying something like "It Works!". Even if for some reasons you did not choose to install them the first time, you can either add later either using one line of command, or using GUI, which is just as easy as using AppStore. What AppStore can never do though, is to retrieve the source code and compile it for your in just a few lines of commands. And can it update software not installed from AppStore? Well Linux can.

Indeed it was. My advice was to just use an off-the-shell web host like Dreamhost. However, the customer needed some specific requirements and software.


You simply can't make any sort of general statements about what Linux can or can't do. Linux is just the kernel. Each distro is different and each individual installation is really a unique operating system. Alas, Linux (in the broad sense) cannot do what you claim. I didn't need much beyond LAMP, but I did need ffmpeg. It is not possible to retrieve the source code and compile it in just a few commands. I had to physically exercise my open source rights and modify the souce code to make it compile. I downloaded the source directly from the ffmpeg.org. It wasn't a difficult change to make and the change is well known, but even I, Linux basher that I am, was surprised that I had to do that in late 2013.

Dec 22, 2013 8:27 PM in response to etresoft

Well I find your attitude extremely odd about Linux and Apple.


Put it in a simple term, if Apple can't do something, it's your own fault. Either because you did not buy Apple's product, or because you are not supposed to expect it to work. If Linux or open source software did not work, it's the software's fault, since it's a bad software.


Like you said, the forum is "littered with people" who have various issues. But wait, isn't that what the forum is for?


The Linux forums are also "littered with people" who have various issues. Difference is, people ask for log outputs and solve most problems with just a few lines of commands.


By the way, did Apple give you a free webserver with ffmpeg?

Dec 22, 2013 8:51 PM in response to tristonej

tristonej wrote:


Well I find your attitude extremely odd about Linux and Apple.

Alas, this is an Apple pond and you are the fish out of water. 🙂


Put it in a simple term, if Apple can't do something, it's your own fault. Either because you did not buy Apple's product, or because you are not supposed to expect it to work. If Linux or open source software did not work, it's the software's fault, since it's a bad software.

I never said Linux or open source software was "bad". Linux is a very robust kernel and there are many thousands of open source projects. Some of those projects are very good and some are very bad indeed. The same is true for proprietary software. My objection is to the design philosophy of "download the source and hack it up" or worse, "use XXX package manaager" when said package managers only work with the easy packages.


Like you said, the forum is "littered with people" who have various issues. But wait, isn't that what the forum is for?


The Linux forums are also "littered with people" who have various issues. Difference is, people ask for log outputs and solve most problems with just a few lines of commands.

If you are going to quote me, pray don't engage in creative abridgement. I said the forums are littered with people who buy cheap NAS devices running various unknown and/or obsolete versions of Linux with Netatalk, expecting to perform Time Machine backups, and are surprised when they don't work. I encourage those people to use the various vendor and Linux forums to get their software running. These forums are not appropriate.


By the way, did Apple give you a free webserver with ffmpeg?


Pretty much. Apple comes with all sorts of free software up to, and including a webserver that work with little configuration. There is some configuration required for a webserver, but far less on OS X than on Linux. That is because Linux is like a box of chocolates. You never know what you're going to get. I would have much preferered to start from OS X and only have to install ffmpeg. Instead, on Linux, all I had was sshd, initd, yum, and maybe a couple of other things. I had to install everything from bind to my web application and everything in between. It is nice that I now know how to install all of that stuff. It is even better that I didn't have to learn it all for free. But my customer would have gotten greater value from either Dreamhost or an internal OS X-hosted web server. That was my recommendation to them before starting and that recommendation still holds because I worry about all of the software I installed that isn't getting automatic updates like Mavericks provides. Luckily, the customer has already exhausted their disk space and will likely be moving to an OS X-hosted, internal web server shortly.

Dec 28, 2013 1:28 PM in response to tristonej

Hi tristonej,


I dont know why etresoft is giving you so much grief over an excellent question.



Anyway, I'm glad you took the time to reply with the answer to this as i was just setting this up on my linux server and also came across the exact same issue.


Your full answer worked perfectly for creating the Time Machines own hostname, now the Mac can see both SMB and AFP.


The only gripe i have now is the need to set up a script to prevent the mac from disconnecting from the SMB share when resuming from sleep.


Thanks again for your answer!



tristonej wrote:


Hi,


I think I solved this issue after a couple of hours. Though not sure, it's much likely OSX can not display smb and afp shares under the same host. It should be easily verifieable by installing a virtual machine software and create a windows guest in OSX, and then NAT the netbios ports.


The changes are mostly in avahi.


  • In /etc/avahi/avahi-daemon.conf, uncomment and set the host-name to whatever you like. Make sure it's different than your samba hostname.
  • In /etc/avahi/hosts, add one line like below, assuming your afp hostname is "tm" and IP address is 192.168.1.10.
    192.168.1.10 tm.local
  • Just to be safe, in /etc/netatalk/afpd.conf, change your server configure line by prepending the hostname "tm" so that it looks something like
    tm - -tcp -uma_guest.so ...
  • Reboot avahi
    service avahi-daemon restart
  • Reboot netatalk
    service netatalk restart
  • And your're done.

...


Have a good New Year!

Dec 28, 2013 2:23 PM in response to Troxeh

Troxeh wrote:


I dont know why etresoft is giving you so much grief over an excellent question.

Because this is not a Linux support forum.


Your full answer worked perfectly for creating the Time Machines own hostname, now the Mac can see both SMB and AFP.


The Mac could always see both services.


The only gripe i have now is the need to set up a script to prevent the mac from disconnecting from the SMB share when resuming from sleep.


There is no such "need". See the link I posted about for setting up automount.

Dec 28, 2013 9:51 PM in response to Troxeh

Hi Troxeh,


I'm glad my post is of some use to you and thanks for your good wishes!


I did tried to go to the bottom of this and here's what I found.


Different than expected, one can not use NAT to provide SMB shares to other hosts from a guest OS on OSX or any Linux/UNIX host. Because port number below 1024 can only be used by root user and even if one NAT those as root the file sharing would only work between the guest and host according to this post. After NATting TCP and UDP port 135-139 and 445, the SMB host did show up in windows network but connection always fails. So this is a dead end.


And interestingly, OSX does provide SMB share capability as well. You can enable that in system preference-> sharing -> file shareing -> options. And once you do that the 2 types of shares do live well with each other. No problem browsing, either. How does OSX do that? My guess is that's done using mDNS. So I issued the following command from my Linux server.


avahi-browse -a


And Bingo! After enabling SMB share from OSX I can see 2 extra entries saying my MBP is serving "Microsoft Windows Network local" for IPv4 and IPv6. Since mDNS is almost only used by Apple, they can quite safely assume the host is running OSX and hence display the right icon.


I guess if we add a simiar entry in avahi config we can also fool OSX into believing this is another OSX host providing both afp and smb shares. I'll probably try that someday for fun but won't actually configure avahi that way as it does not add any value.


Wish you a happy new year, too!


Troxeh wrote:


Hi tristonej,


I dont know why etresoft is giving you so much grief over an excellent question.



Anyway, I'm glad you took the time to reply with the answer to this as i was just setting this up on my linux server and also came across the exact same issue.


Your full answer worked perfectly for creating the Time Machines own hostname, now the Mac can see both SMB and AFP.


The only gripe i have now is the need to set up a script to prevent the mac from disconnecting from the SMB share when resuming from sleep.


Thanks again for your answer!

can smb and afp coexist on the same host?

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