Making the most of Ubuntu's personal cloud service

© Thomas Pajot - 123RF.com

© Thomas Pajot - 123RF.com

One Up

Ubuntu One is a service from Canonical that lets you access your documents, photos, music, and files everywhere, and it's in every version of Ubuntu. Instead of just "one weird trick" to get the most out of your Ubuntu One account, here's a bunch.

Ubuntu One is Ubuntu's cloud service. As its own website says, Ubuntu One is "the personal cloud that brings your digital life together, so you can enjoy your content, your way, wherever you are" [1].

Simply put, you can use Ubuntu One to store, sync, and stream photos, documents, and music, and the service is part of Ubuntu as well as available on other devices and platforms, such as Android, Windows and Mac. That much is apparent, but, in this article, I will show you some creative ways to use the service, which will make your life as an Ubuntu user easier.

Beam Up your Folders

If you're already using Ubuntu One (U1), then you know that it creates a new folder named Ubuntu One in your home folder, which is automatically synced with the cloud. However, you can add other folders to Ubuntu One as well.

Some good examples include Documents and Pictures. Simply add your Documents folder to U1 (Figure 1); then a month from now when you're away from your desk and think, "ooh, I wish I had that document," you can just grab it on your phone or borrow someone else's laptop and get from there.

Figure 1: Say Add a folder from this computer and choose your Documents folder.

Think of this as a safety net: You never need to email a file to yourself ever again just to make sure it's on your phone. The documents you've created or saved are instantly accessible to you from anywhere you can access the Internet.

Sharing

It's fairly common to want to send a file to a business contact, a friend, or a colleague. Obviously, one way to do that is just to attach the file directly to an email; however, that approach is sometimes fairly inconvenient. Gmail will refuse to send attachments larger than 25MB; your recipient may not be able to receive large attachments even if you can send them; and it's often quite nice to be able to read your mail without having to download a large attached file first!

A convenient alternative is to send a link to the file instead, and Ubuntu One makes this really easy. To begin, make sure the file is in Ubuntu One already. If you added your Documents folder to U1 as above, and your file is in there somewhere, then you're already done. If not, simply drop a copy of the file into your Ubuntu One folder. Then, launch the Ubuntu One app from the Dash and, on the Share Links tab, you can search by name for the file you want to share (Figure 2).

Figure 2: Find your file to share within the Ubuntu One app.

Next, click on the file you want and then click on Copy Link (Figure 3). You now have a link that you can send to anyone, and your colleagues can download the file at their leisure (Figure 4).

Figure 3: Ubuntu One has now created a link for your file.
Figure 4: Add the link to an email or a message, and recipients can get your attachment whenever they choose.

Mozilla Thunderbird, the default email app for Ubuntu 11.10 and later, has Ubuntu One support for emailed attachments built in. Visit Mozilla support [2] to learn how to enable what Mozilla calls "FileLink," which is the integration with Ubuntu One.

Doing the Books

If you enjoy reading ebooks, you probably already know about Calibre [3], the ebook management tool. Calibre has a useful set of features to sync books to your phone or e-reader devices, but it involves the hard labor of plugging in a cable or being on your home WiFi. Putting your ebooks into Ubuntu One gives you a wireless way to get at them all on your phones and devices without having to sync them all every time.

The obvious approach is simply to add Calibre's library folder to Ubuntu One directly. But, actually, that's a no-no, because the folder is for Calibre's internal use only and should not be messed with. Instead, use the hugely comprehensive set of Calibre tools to export a copy of your library to an Ubuntu One-synced folder. I use Documents/Books.

Calibre can be completely controlled from the command line, which is ideal for this setup. The calibredb command is detailed and fairly esoteric; however, with a little experimentation, it can export your whole library in the way you prefer to somewhere it can be synced. For example,

calibredb export --all  --dont-save-cover --dont-write-opf --formats=EPUB \
  --to-dir=$HOME/Documents/Books \
  --template="{authors}/{series:|(| }{series_index:0>2s| |) }{title}"

will create a duplicate library for you to sync with books organized by author and then by series. Thus, Aristotle's Ethics will be in Documents/Books/Aristotle/Ethics.epub, and the first book of A Song of Ice and Fire will be in Documents/Books/George R. R. Martin/(aSoIaF 01) Game of Thrones, A.epub.

Exactly how the books are classified is up to you. The --template option controls how this works, and the Calibre documentation shows how to customize it. Browsing your whole collection of books for reading on your device is then easy using the Ubuntu One apps for Android, iOS, N9, and the web.

Backing Up

The world is divided into two groups: People who are obsessive about making backups of their stuff, and people who just haven't been burned yet. To hit a happy medium, your backups should be automatic and zero-effort. Fortunately, Ubuntu provides that for you. Ubuntu's built-in backup tool (start Backup from the Dash) can set up your machines to copy your files to Ubuntu One in two clicks.

Switch Automatic Backups to On in the Backup app. It will then back up your stuff to Ubuntu One with no extra work at all. Do that now. Put down this article, switch that thing to On, and then carry on reading. Backups need to be zero-effort, off-site, and automatic, and Ubuntu's Backup app in conjunction with Ubuntu One provides just that.

Clientless One

Sometimes, you find yourself wanting to get at your files onto Ubuntu One without having the Ubuntu One client around. Obviously, the U1 website works fine for this if you want to download or upload just a few files, but if you have lots, then using the website can be quite tedious.

Installing the Ubuntu One client is the best way to send files up and down the line, but perhaps you don't want to do that this time. Maybe you're on a headless server, or you don't want to sync down all your Ubuntu One content to this machine.

Luckily, you have an alternative: u1ftp [4]. This tool runs as a little program on your machine and acts as an FTP server that talks to Ubuntu One under the covers.

This means that you can use any FTP client to connect to it and see all your Ubuntu One storage. Uploading or downloading lots of files can then be done in the same way that you might use FTP to upload or download files from any server, such as a website server. Download u1ftp [5] and run it with python u1ftp-0.1.zip. Then, use your FTP client of choice to connect to http://localhost:2121. This works anywhere that you have Python, whether it's a Linux desktop machine, Windows, OS X, or headless Ubuntu server. See Listing 1 for an example of u1ftp in action.

Listing 1

Accessing Ubuntu One with u1ftp

01 <In one terminal...>
02 $ wget -q https://launchpad.net/u1ftp/trunk/0.1/+download/u1ftp-0.1.zip
03 $ ls
04 u1ftp-0.1.zip
05 $ python u1ftp-0.1.zip&
06 Listening on ftp://127.0.0.1:2121/
07 $ ftp localhost 2121
08 Connected to localhost.
09 220 Twisted 11.1.0 FTP Server
10 Name (localhost:aquarius): your Ubuntu One email
11 331 Password required for your Ubuntu One email.
12 Password:
13 230 User logged in, proceed
14 Remote system type is UNIX.
15 Using binary mode to transfer files.
16 ftp> ls
17 200 PORT OK
18 125 Data connection already open, starting transfer
19 drwxr-xr-x   1 user      group                   0 Jan 01  1970 Documents
20 drwxr-xr-x   1 user      group                   0 Jan 01  1970 Ubuntu One
21 drwxr-xr-x   1 user      group                   0 Jan 01  1970 Work

Hacker Friendly

If you're into getting your hands dirty, Ubuntu One is also fully available to programmers. All of its capabilities are available through its APIs, meaning that you can build Ubuntu One into apps you write or write shell scripts or small programs to do interesting things that the Ubuntu One team hasn't thought of.

For example, you might want to make not just a file but a whole folder available for people to view. Sharing a file gets you a link to it, as above, but you can't do that with a folder. However, a little Python work with the Ubuntu One API, and you can sort that out. For example, check out the script I created [6]. To use it, you can simply type python u1-publish-folder path/to/some/folder in a terminal window. You can see sample run of the u1-publish-folder process in Listing 2.

Listing 2

Sharing a Whole Folder with the U1 API

01 $ python u1-publish-folder "Ubuntu One/Published Folder/"
02 Examining folder /home/me/Ubuntu One/Published Folder
03 Publishing 3 files...
04   published /home/me/Ubuntu One/Published Folder/site-text.txt
05   published /home/me/Ubuntu One/Published Folder/website-screenshot.png
06   published /home/me/Ubuntu One/Published Folder/How fast.ogg
07 Constructing the folder index...
08 Waiting for Ubuntu One to upload index...
09 Done.
10 Publishing the folder index...
11 Folder index now available at http://ubuntuone.com/7FzTucUIxKbfLvADU2JTCC

Going Meta

When you write useful little programs and scripts like this, you can put them in their own folder and add that folder to U1. Then, these items will be available across all your machines, and you will never lose them, even if you reinstall your system with, for example, a new version of Ubuntu.

U1 has APIs for handling files as well as syncing, sharing, music streaming, and signing in across websites with your Ubuntu One account. It can also handle data syncing across Ubuntu, Android, iOS, and the web. Additionally, the process is well documented [7], so if you wish this list of tips contained something that it doesn't, you can always make it yourself! l

Figure 5: To keep your stuff safe, switch Automatic Backups to ON. That's it.

The Author

Stuart is a web hacker, author, and speaker living in the UK. He runs Kryogenix Consulting, a custom development and consultancy business. He writes books about JavaScript and talks to people about Ubuntu. His code and writings (and the occasional rant) are to be found at http://kryogenix.org and @sil on Twitter.