Netatalk does everything Apple Time Capsule does, for a lot less money

Back to the Future

Once the Netatalk library is working, you should take a look at the Finder window on your Apple computer. As long as the Mac is hooked up to the same local area network as the Raspberry Pi, the Raspberry Pi will appear as a Time Capsule with the corresponding icon.

Clicking on the Raspberry Pi entry in the sidebar brings up a dialog that lets you log on. For now, just authenticate as a guest (Figure  1). Within just a few moments, the Finder displays the contents of the Time Capsule you have built: An empty TimeMachine folder!

Figure 1: Logging in as a guest is fine for everyday purposes. Those users who need more security should activate the authentication procedures.

On the Mac, you should next click on the Time Machine icon in the menubar at the top right and select the Open Time Machine Preferences entry.

Next, turn on the software with the slider on the left-hand side if it is not already running. Then, click on the Select Disk button and select the TimeMachine volume on the Raspberry Pi (Figure  2). Various possibilities are available for setting up an authentication mechanism if you also want to protect data with a password.

Figure 2: If logging on as a guest suffices for the purposes of data security, you have now successfully set up Time Capsule.

The most straightforward way is to comment out the uam list = uams_guest.so line in the /etc/afp.conf configuration file on the Raspberry Pi by prefixing the line with a semicolon. Then, uncomment the next line ;uam list = uams_dhx.so uams_dhx2.so by removing the leading semicolon then restarting the service with:

$ sudo service netatalk restart

The Raspbian system acts as the authenticating instance after a restart. Now you need to add your user to the Raspberry Pi and create a password:

$ sudo useradd -m -U <username>
$ sudo passwd <userpass>

With these new credentials, you should be able to authenticate yourself on the Time Machine.

Retreat

As a rule, the Rasp Pi should not be left sitting on your desk or the kitchen table with the keyboard attached, because you run the risk of interrupting and damaging a backup in progress. Therefore, it's a good idea to retreat and set up your Rasp Pi for access via SSH.

To begin, you should completely shut down any Apple computers connected to the Pi. Next, check to see whether the Rasp Pi is actually writing all of the remaining data from temporary storage onto the hard disk. This is accomplished with the sync command in a terminal window. Then, shut down the Rasp Pi with the sudo init 0 command and remove the keyboard and monitor.

If you want to access the Raspberry Pi at a later date for maintenance (e.g., to change a password or set up a new user), you should do so from your Mac in the Terminal program (Applications | Utilities | Terminal.app). If you don't know the IP address of your Raspberry Pi computer, download the Bonjour Browser  [9] program and open the Apple File Sharing entry in the menu. Look for the Raspberry Pi in the list of entries. The IP address and the AFP port (548) are displayed, separated by a colon.

Type the following command in the Mac terminal (Figure  3) to access the Rasp Pi:

Figure 3: Creating a secure connection to the Rasp Pi in the Mac terminal program.
$ ssh pi@<IP address>

The first time a connection is made, the software asks whether you trust the remote device. Answer this question in the affirmative by typing yes and pressing Enter.

Notice that the command-line prompt changes: You are now working on the remote computer. At the prompt, enter the password of Raspberry Pi user pi. After finishing your work, log out with exit.

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content