PDA

View Full Version : Sharing files with macs



gharris999
2009-03-07, 11:21
I'm setting up a linux SqueezeCenter server for a household that is all Mac. What's the standard way that linux folks share files with Macs? NFS? Samba and have the macs connect via cifs? I want to make it as easy as possible for these folks to be able to push new content into the SqueezeCenter library.

signor_rossi
2009-03-07, 12:12
I'm setting up a linux SqueezeCenter server for a household that is all Mac. What's the standard way that linux folks share files with Macs? NFS? Samba and have the macs connect via cifs? I want to make it as easy as possible for these folks to be able to push new content into the SqueezeCenter library.

Why not simply use sftp to push the files on the server? There should be nice Mac clients available and it's most hassle free.
Otherwise sshfs could be an option when the folks also want to access the files they store on the server with apps on their Macs seamlessy.
Samba is overkill imho (and I couldn't set it up properly ;) ).

gharris999
2009-03-07, 12:34
Why not simply use sftp to push the files on the server? There should be nice Mac clients available and it's most hassle free.
Otherwise sshfs could be an option when the folks also want to access the files they store on the server with apps on their Macs seamlessy.
Samba is overkill imho (and I couldn't set it up properly ;) ).
As long as you don't care about security, samba is dead simple to set up. I have a generic smb.conf file that I edit to suit each installation..usually just changing the server name and the workgroup name. I'd be happy to "share."

Can you tell me more about sshfs? I take it that both fuse and sshfs would have to be installed on each mac client, yes? Does the linux server need anything other than sshd to be running?

signor_rossi
2009-03-07, 12:54
I take it that both fuse and sshfs would have to be installed on each mac client, yes? Does the linux server need anything other than sshd to be running?

Yes and
No, sshd is enough.

http://code.google.com/p/macfuse/

http://code.google.com/p/macfuse/wiki/MACFUSE_FS_SSHFS

But I must admit that I used it only briefly on my brothers' iBook (it worked, though!) and use it regularly only in Linux where it is dead easy to set up (to edit tags on my squeezecenter server for example :) ).
And fter looking it up again for Mac it seems to me that probably it is too much hassle to set up and mantain on many computers you haven't easily access to.

epoch1970
2009-03-07, 13:54
Best choice is to install netatalk on the linux server. The macs will see AFP volumes, they will feel at home. Netatalk is quite easy to configure.
NFS is also a good choice, but X.5 only. Under X.4, the NFS/Finder relationship is of the love-hate kind.
Samba is ok, but much slower than AFP on macs. Configuring samba is much more complicated than configuring netatalk.

For the underlying FS, I use ext3 all the time. You could use HFS+ as well, but right now I fail to see an advantage to it. Perhaps when trying to use a volume for TimeMachine backups?

UPDATE: FYI, the contents of my conf files. /etc/netatalk/AppleVolumes.default file:

# <Tons of comments truncated >
#
# By default all users have access to their home directories.
#~/ "Home Directory"
/var/data/audiotheque "Audiotheque" cnidscheme:cdb
/home/mom "Mom" cnidscheme:cdb options:usedots
The CDB identification backend is required by X.5, AFAIK. Yes, this is the complete config file. It's 99% comments.

Now, the /etc/netatalk/afpd.conf file:

# <Tons of comments truncated >
# default:
# - -transall -uamlist uams_clrtxt.so,uams_dhx.so -nosavepassword
"Otto" -tcp -uamlist uams_guest.so,uams_dhx.so -noddp -guestname "mom"

Server name is "Otto", don't remember why I hardcoded it. X.5 automatically logs in as guest, so I've set guest to be the same as the one user owning all media files; That's insecure, but easy.

Finally, my /etc/defaults/netatalk file, which is used under Debian to overload the settings of the various files in /etc/netatalk. It's a bit messy, sorry. The idea is to avoid starting totally obsolete apple stuff, like appletalk printer sharing and the like, which would go unused anyway, and really slow down server startup:

# Change this to increase the maximum number of clients that can connect:
AFPD_MAX_CLIENTS=20

## 150908: I REMOVED THOSE MARKED BY "##" .
##ATALK_NAME=`/bin/hostname --short`
# specify the Mac and unix charsets to be used
ATALK_MAC_CHARSET='MAC_ROMAN'
ATALK_UNIX_CHARSET='LOCALE'
# specify this if you don't want guest, clrtxt, and dhx
# available options: uams_guest.so, uams_clrtxt.so, uams_dhx.so,
# uams_randnum.so
#AFPD_UAMLIST="-U uams_dhx.so,uams_clrtxt.so,uams_randnum.so"
# Change this to set the id of the guest user
##AFPD_GUEST=mom
# Set which daemons to run (papd is dependent upon atalkd):
##ATALKD_RUN=yes
ATALKD_RUN=no
##PAPD_RUN=yes
PAPD_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes
TIMELORD_RUN=no
A2BOOT_RUN=no
# Control whether the daemons are started in the background
ATALK_BGROUND=yes
# export the charsets, read form ENV by apps
export ATALK_MAC_CHARSET
export ATALK_UNIX_CHARSET

The set of files work reliably for a client under X.4 or X.5. I built myself a netatalk server binary back in mid-2008; at that time the stock netatalk server would not accept 10.5 clients (some kerberos issue.)
I guess the stock binary in current linux distros is fixed and works with X.5 clients. If not, I have a .deb file for i386 if you need.

Now, if you want to be nice, you can also make sure that Avahi sends some info, which is cool for mac clients which rely so much on Rendez-vous for networking. In /etc/avahi/services I have 2 files, one for the AFP service, another for Squeezecenter that runs on the server. I don't know if the AFP one is useful, I'd expect netatalk to dynamically advertise its presence. SC7 on linux does not, so a static file is required.
/etc/avahi/services/afpd.service:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
</service-group>

/etc/avahi/services/squeezecenter.service:

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">SqueezCenter on %h</name>
<service>
<type>_http._tcp</type>
<port>9000</port>
<txt-record>path=/</txt-record>
</service>
<service>
<type>_slimhttp._tcp</type>
<port>9000</port>
</service>
<service>
<type>_slimcli._tcp</type>
<port>9090</port>
</service>
</service-group>

My avahi-daemon.conf file (can't guarantee everything is valid here):

# ...
# See avahi-daemon.conf(5) for more information on this configuration file!

[server]
host-name=otto
domain-name=local
#browse-domains=0pointer.de, zeroconf.org
use-ipv4=yes
use-ipv6=no
#check-response-ttl=no
#use-iff-running=no
enable-dbus=yes
#disallow-other-stacks=no
#allow-point-to-point=no

[wide-area]
#enable-wide-area=yes

[publish]
disable-publishing=no
disable-user-service-publishing=no
#add-service-cookie=yes
publish-addresses=yes
publish-hinfo=yes
publish-workstation=yes
publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
publish-resolv-conf-dns-servers=yes
publish-aaaa-on-ipv4=yes
publish-a-on-ipv6=no

[reflector]
#enable-reflector=no
#reflect-ipv=no

[rlimits]
#rlimit-as=
rlimit-core=0
rlimit-data=4194304
rlimit-fsize=0
rlimit-nofile=30
rlimit-stack=4194304
rlimit-nproc=3

With Avahi deamon installed (no need for the other avahi modules), mac users can see services advertised as using HTTP in the "Bonjour" tab of Safari. Pretty useful, and besides, the contents of the tab being dynamic, this more or less tells you whether the server is up or sleeping... (best wake-on-lan utility for mac desktops, IMO, here: www.apple.com/downloads/macosx/networking_security/wakeonlan.html)
However, avahi seems to be grumpy upon wake-on-lan. On an Intel machine, I have no problems at all. On an AMD with the exact same config, I have to reload the avahi daemon as part of the wake-up process, otherwise it fails to advertise the services again.
Finally, you can also create an avahi .service file pointing, say, to static HTML help pages on the server, or elsewhere. This bonjour tab can get quite useful once you've started using it. Here is, for example, a pointer to the local phpsysinfo server status page:

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h System Monitor</name>
<service>
<type>_http._tcp</type>
<port>80</port>
<txt-record>path=/phpsysinfo/index.php</txt-record>
</service>
</service-group>

Caveat: as far as I know, Firefox shows total disdain to zeroconf, there is not even a plugin available. All these niceties are only available under Safari.

UPDATE 2: Some useful links.
- ht tp://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/ (general info, getting old, don't miss the most current comments at the bottom of the page)
- ht tp://www.flokru.org/2008/02/29/time-machine-backups-on-network-shares-in-leopard/ and
ht tp://www.flokru.org/2008/03/15/time-machine-backups-on-network-shares-2-possible-problems/ (TimeMachine workaround still needed and explained. Using HFS+ as the native FS brings no improvement, I just tried; Netatalk v2.1 should deprecate this.)
- ht tp://www.sanityinc.com/articles/mac-screen-sharing-with-linux (Screen sharing: access the linux server GUI with a simple click in the Finder's left panel. This works easy, unless using the wrong VNC server implementation on the linux server --recent VNC protocol version needed. VNC4 free edition was *not* working some months ago, tightvnc was ok)

UPDATE 3: One last comment. If you're interested in centralized backups, for macs and about any other platform: have a look at backuppc.sf.net . The (perl) backuppc server pings machines regularly, then connects and does backups. The system is server centric, while TimeMachine is client-centric. I've started doing backups of my machines (macs, linuxes, win XP --well, not really) using backuppc 2 years ago. Almost 0 maintenance required since then, and works beautifully. Backups/restore/status via a web interface. Wonderful software, plagued with a lousy name.