Getting Started with Netatalk Client

This is a quick guide on how to use the two different AFP clients included with the Netatalk Client suite: the FUSE client and the command line client.

The FUSE client

This will let you mount remote filesystems over AFP, and access them as if they were local filesystems.

As the user who will be needing to access the files, start the management daemon by running:

afpfsd --manager

This should fork off. You should see messages in /var/log/messages. For more details, run it with the ‘–debug’ option to see detailed debug info.

Note that if afpfsd is not running, afpc fs commands or mount_afpfs will start it automatically, so in most cases you don’t need to start it manually.

List AFP servers advertised on the local network through Zeroconf:

% afpc discover

Use --verbose to include resolved addresses, raw TXT data, and separate _device-info._tcp entries, or --json for machine-readable output. The normal output shows the DNS-SD instance name, device model from a matching _device-info._tcp advertisement, resolved target, and advertised port.

Mount a discovered service by its exact instance name with --service. The mount command resolves the address and advertised port non-interactively; use afpcmd --browse for a live picker.

% afpc fs mount --service "Office File Server" --user myuser \
    --volume "File Sharing" /home/myuser/fusemount

If --volume is omitted, the command authenticates with the service, prints the volumes available to that user, and exits without starting afpfsd. A trailing mountpoint is accepted but is not required in this mode.

Mount the File Sharing volume from afpserver.local on /home/myuser/fusemount authenticated as user myuser (you will be prompted for the password):

% mount_afpfs "afp://[email protected]/File Sharing" /home/myuser/fusemount

After inputting the password when prompted, you should be able to access files on fusemount.

Mount the Dropbox volume as guest without authentication (the server must allow guest access):

% mount_afpfs "afp://afpserver.local/Dropbox" /home/myuser/fusemount

The same, but forcing the UAM of your choice with the AUTH parameter (usually not needed):

% mount_afpfs "afp://myuser;AUTH=dhx:[email protected]/File Sharing" /home/myuser/fusemount

You can see FUSE status by running ‘afpc fs status’. See afpfsd(1), mount_afpfs(1) and afpc(1) for more info.

Mounting on boot

For operating systems that support it, add an AFP mount to fstab so it mounts automatically on boot. The FUSE filesystem source is ‘afpfs’, and can be configured as follows:

  1. create a file called ‘/etc/fuse.conf’ with one line: user_allow_other
  2. make sure that any user doing a mount is a member of the group ‘fuse’ so it can read and write to /dev/fuse
  3. create an entry in /etc/fstab entry in the following format:

    afpfs#afp://username:mypass10.211.55.2/myafpvol /tmp/xa20 fuse user=myuser,group=fuse 0 0

Here, username and mypass are the login information on the server 10.211.55.2. The volume name is myafpvol. /tmp/xa20 is the name of the mountpoint. The user= field is the local user, group needs to be the same the group owner of /dev/fuse (which is typically fuse).

Yes, you will need to put your password in clear text. There is currently no facility to handle open directory. Patches welcome.

Running the command line client

There are two modes:

interactive mode

afpcmd is a command line tool like an FTP client.

Just run:

afpcmd "afp://username@servername/volumename"

To browse AFP services advertised on the local network, use --browse, then select a service number:

afpcmd --browse

The picker lists advertised services and quit; it does not ask for a manual host or address. After selection, enter a username and hidden password, or leave the username blank to request guest access. Pass a known server in an AFP URL as shown above.

If you enter no volumename, afpcmd opens a numbered volume picker after connecting. Selecting a number attaches that volume; q returns to the operating-system prompt by quitting afpcmd. You can put a password after the username - “username:password” - but it’s usually better to let it prompt you for the password so it doesn’t end up in your shell history.

Examples of available commands:

Others are available too; touch, chmod, chown, rm, mv, etc. See afpcmd(1) for more.

batch transfer

This will let you quickly transfer one file or recursively a directory, and then return you to the command prompt.

E.g.

> afpcmd afp://user:pass@server/alexdevries/linux-2.6.14.tar.bz2 .
Connected to server Cubalibre using UAM "DHX2"
Connected to volume alexdevries
    Getting file /linux-2.6.14.tar.bz2
Transferred 39172170 bytes in 2.862 seconds. (13687 kB/s)

Transfers preserve FinderInfo, ResourceForks, generic extended attributes, file modes, and modification times by default. The default ‘-M auto’ mode uses filesystem extended attributes for generic xattrs when available, and falls back to Netatalk AppleDouble EA sidecars otherwise. FinderInfo and ResourceForks use native filesystem xattrs on macOS, and macOS AppleDouble sidecars on other systems. Use ‘-M netatalk’, ‘-M xattr’, or ‘-M macos’ to force local metadata storage, and ‘-M none’ to transfer only the data fork.

See afpcmd(1) for more information.

getting status

You can get status information on servers with ‘afpgetstatus servername’.
This provides some information without having to log in.

See afpgetstatus(1) for more information.