Thursday, March 13, 2008

Installing FreeBSD 7.0 - Apple shares

Ok so you want your FreeBSD machine to share files with Apple machines.

Assuming that you have recompiled your kernel with option NETATALK you can go on and install the netatalk deamon.
  • Execute: cd /usr/ports/net/netatalk
  • Execute: su and enter password 
  • Execute: make install clean
  • Execute: cd /usr/ports/net/howl
  • Execute: make install clean
  • Execute: ee /etc/rc.conf
  • Add lines:
slpd_enable="YES" # Promotes services on network
netatalk_enable="YES" # Enable netatalk
atalkd_enable="YES" # Deamon
cnid_metad_enable="YES" # No idea
afpd_enable="YES" # Apple File Protocol deamon

# This is a part of howl
mdnsresponder_enable="YES"
mdnsresponder_flags="-f /usr/local/etc/mDNSResponder.conf"
  • Exit editor: Press ESC, then A and then A
  • Execute: ee /usr/local/etc/mDNSResponder.conf
  • Add lines:
MyServerName _afpovertcp._tcp local. 548
MyServerName _ssh._tcp Servers. 548

It's important that everything is separated with tabs in this file. It's also very important that there is a empty line at the end of the file.

The first line see to it that your macs will find the shared file folders on the network. The second line will promote ssh login.

Now we want something to share! I created a folder in /usr that I call netshare. If you want to follow my example do this:
  • See to it that you still have root access
  • Execute: mkdir /usr/netshare
  • Execute: ee /usr/local/etc/AppleVolumes.default
  • Scroll to bottom of file
You will probably have a ~ on the last line. This means that the authenticated users home folder is shared. If you don't like that, just remove the ~. Anyway, we want to share our common /usr/netshare folder. I also decided that only users belonging to group shares should have access to this folder. This is why I choose to install webmin so go ahead and create a new group.
  • Web browser: your webminaccess (mine is https://192.168.0.1:10000)
  • Login
  • Unfold System and click "Users and Groups"
  • Scroll down to "Local Groups" and click "Create a new group"
  • I called my group shares, you can call it whatever you like
  • Add members to the group, I added my self and root
  • Click "Create"
  • Back to the AppleVolumes.default file and add a line:
/usr/netshare netshare allow:@shares

First part is of course the path to the shared folder. Second the display name of the share. Third the rights to this share. When defining right to groups you use @ as prefix. Say that you want the mygroup group and myuser to have access then you would write allow:myuser, @mygroup.

You can learn more about it here AppleVolumes.default

Save your file!

Finally you need to update the rights to the actual folder. Since I'm not a unix person from the beginning I'm taking the sneak way around chmod and chown and I use webmin instead.

  • Login to webmin
  • Unfold the "Others" item and click "File Manager"
  • A java applet wan't need your permission to run, just accept and you will end up in a nice looking gui application.
  • Click usr in the left tree and select netshare in the right listing
  • Click the "info" icon in the toolbar
  • In the "Permissions" area click Read, Write, List on Group. I personally deselected any rights for "Other".
  • In the "Ownership" area change group to shares or whatever group you like
  • In the "Apply changes to" dropdown choose "This directory and all it's subdirectories"
  • Click "Save" button in the bottom

Reboot your machine!

Your FreeBSD machine should automatically show in Finder on all your OS X machines on the network. It should display your home folder and the netshare folder.

1 comment:

Anonymous said...

Thanks for the guide, it really helped out!