You want to use Dropshare for Mac and iOS with your own server instead of Amazon S3 or Rackspace Cloud Files? Perfect! This article explains how to set up Dropshare for Mac and iOS with a DigitalOcean Droplet.
0. Prerequisites
- Basic server knowledge (e.g. how to use SSH on your Mac)
- A DigitalOcean account
- Dropshare for Mac and iOS (Not sure yet? Download the free trial version!)
1. Creating a new Droplet
Go to the DigitalOcean Control Panel and create a new Droplet.
Select a hostname of your choice, but make sure you’re able to add a new A record, e.g. in your DNS or domain providers control panel, once DitialOcean told you the IP address of your new Droplet.
You have to select a Droplet size of your choice as well. The smallest Droplet for $5 / month is perfectly suitable. After selecting a region that is closest to you or the people you are mainly sharing files with, you should as well enable IPv6.
Image-wise this article assumes you’re using Ubuntu 14.04 (x64) or newer, but everything should work as well for any recent Debian version.
You can optionally set up a SSH key for the root user of your new Droplet. In case you’ve already set up a SSH key in the Control Panel, just select it in the last step before you create the Droplet. Otherwise click Add SSH key and follow the instructions to set up the SSH key-based root login for the Droplet.
Summary
We’re creating a new Droplet for $5 / month in the London 1 data center, enabling IPv6 and using the Ubuntu 14.04 (x64) image. Feel free to adjust these configuration according to your needs.
2. Setting up the DNS
It may take up to 60 seconds for your Droplet to be created. Once that is finished, you will be redirected to your Droplet’s detail page which will expose the IP adress of it. Head to your DNS or domain provider’s control panel to set up a new A record according to the hostname you selected in step 1.
In our case, we were using CloudFlare as DNS provider which we set up like this:
Please consult the user guide of your DNS or domain provider for more information about setting up DNS records.
Summary
We’ve set up a A record pointing to the IP of the newly created Droplet to make the hostname work.
3. Configuring the Droplet
Meanwhile (in case you did not set up a SSH key in step 1) the email containing the root password of your Droplet should have arrived. Open Terminal.app and login as root user:
$ ssh root@<Hostname or ip address of Droplet>
Password: <Enter the root password from the email>
Most probably you will be forced to change the root password upon the first login.
Changing password for root.
(current) UNIX password: <Enter the root password from the email again>
Enter new UNIX password: <Choose a new, secure password..>
Retype new UNIX password: <.. and repeat it>
That’s it, you’re logged in as root on your new Droplet. There’s a few things to do:
- Installing and configuring a web server
- Setting up a user for Dropshare
3.1 Installing and configuring a web server
In this article we will use nginx, a popular fast webserver, to serve files shared with Dropshare. First, we will update the package management sources and install system updates:
# apt-get update
# apt-get upgrade <Optional but recommended>
# apt-get install nginx
nginx is now installed on your Droplet. It has been configured to automatically start on system startup, so there is nothing more to do than starting it right now:
# service nginx start
From now on, the webserver should already be running and serving files from your server. Open http://<Droplet IP or hostname> in your browser and you should see the nginx default page informing you that it has been successfully installed. We now have to configure nginx to serve files uploaded with Dropshare correctly.
# cd /etc/nginx/
# vim sites-available/dropshare <Feel free to use nano or another editor of your choice>
What follows is a very basic configuration of nginx that is just alright for this setup. Please pay attention to the comments in <brackets> as these require your attention (as you might have already figured out)
server {
server_name <Hostname of the Droplet>;
root /home/dropshare/public_html;
autoindex off;
location / {
try_files $uri $uri/ =404;
}
}
We set up nginx to serve the files shared with Dropshare under the given hostname (or any other hostname / domain name that points to your Droplet) from /home/dropshare/public_html, a path that does not exist yet but will be created in the next step.
Finally we have to enable this configuration and reload nginx:
# ln -s /etc/nginx/sites-available/dropshare /etc/nginx/sites-enabled/dropshare
# service nginx reload
3.2 Setting up a user for Dropshare
As a security measure, we will set up a separate user for Dropshare. The uploaded files will be saved in that user’s home directory. We have to allow nginx to read files from that directory to make our sharing solution work.
We will now create a user called dropshare with a home directory in /home/dropshare, and set up the directory for nginx:
# useradd -m dropshare
# cd /home/dropshare
# mkdir public_html
# chown dropshare:www-data public_html
# chmod g+rwx public_html
The user does not need a password as we’re going to set up SSH key-based authentication. We’re creating a new SSH key pair on your Mac:
Execute these commands on your Mac, not in the SSH terminal!
$ cd .ssh
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/<username>/.ssh/id_rsa): dropshare
Enter passphrase (empty for no passphrase): <Enter a secure passphrase, recommended>
Enter same passphrase again:
(...)
You now have created a SSH key pair named dropshare. We now copy the public key to the clipboard so we can set it up on your Droplet:
Execute these commands on your Mac, not in the SSH terminal!
$ cat ~/.ssh/dropshare.pub|pbcopy
Now back to your SSH terminal:
# su dropshare
$ cd
$ mkdir .ssh
$ vim .ssh/authorized_keys <Feel free to use nano or another editor of your choice>
Copy the SSH public key from your clipboard into that file, save and close it. You should now be able to log in as user dropshare on your Droplet via SSH without using a password. Try it out, Open a new Terminal window on your Mac:
$ ssh -i ~/.ssh/dropshare dropshare@<Hostname or ip address of Droplet>
Did it work? Well done! In case you’re being asked for a password, make sure you’ve followed the steps above and enable a more verbose output by adding -vvv
to the SSH command (this will make debugging a lot easier).
Your Droplet is now ready to serve files uploaded with Dropshare. Time to set up Dropshare on your Mac!
Summary
We’ve set up nginx as webserver and created a new user dropshare. We’re successfully able to log in with that user using SSH from our local machine, and nginx is successfully serving files from that user’s home directory.
4. Setting up Dropshare for Mac
Download Dropshare for Mac from the website (or in case you are already very determined from the Mac App Store). Open the Preferences, go to the Connections tab and select SCP over SSH:
The set up is pretty straight forward. Enter the hostname or IP address of your Droplet, and choose dropshare as user name. In case you’ve entered a passphrase while creating the SSH key pair in step 3.2, enter it in the password field. Select both the private and public key named dropshare or dropshare.pub from the .ssh
directory in your home folder (should be opened automatically). Enter the path for Save files at as shown in the screenshot, and finally insert the hostname we’ve set up for nginx in step 3.1.
That’s it! Hit Test connection. If you’ve carefully followed the instructions, a green checkmark will indicate everything’s ready and set. A URL will be copied to your clipboard - try to open it on your browser. The green checkmark should as well be displayed on a page saying that everything is alright. Awesome!
You’re now able to share files with Dropshare for Mac, just drag & drop a file to the menu bar icon or explore many other possibilities to use Dropshare on your Mac.
Summary
Dropshare for Mac has been successfully set up. Start sharing files now!
Anything doesn’t work as expected? Please feel free to drop our support a line, we’re happy to help.
5. Bonus: Set up Dropshare for iOS
Setting up Dropshare for iOS takes less than a minute once you’ve successfully set up Dropshare on your Mac. Go to the Connection preferences again, click the settings icon next the connection you’ve just created and select Export...
This will export your connection to a file that can easily be imported by Dropshare for iOS. Just enter a passphrase to encrypt your connection data and hit Export.. again. A Finder window will open with the encrypted connection file selected.
There are many different ways to copy this file to your iOS device - one of them is using Dropshare Sync, a free service by Dropshare which securely synchronizes your upload history across all your devices (read more). Just sign in to Dropshare Sync on your Mac, and upload the connection file to your server.
Once you have downloaded and opened Dropshare for iOS, sign in to Dropshare Sync on your iOS device. The connecton file will then appear in your upload history on the device. Just open the file then - your iOS device will automatically detect the Dropshare connection file and Dropshare for iOS will prompt for the passphrase you’ve entered just a few second ago.
That’s it! Dropshare for iOS will again test the connection to your server to make sure everything is working fine, and after a few seconds you’re ready to upload files to your own server from your iOS device.
Summary
By exporting our connection data from Dropshare for Mac, we’ve set up Dropshare for iOS in just a minute. Of course Dropshare for iOS is also fully functional without Dropshare for Mac.
We’re planning to release more articles explaining e.g. how to set up Dropshare with Amazon S3 or Rackspace Cloud Files and are happy to receive your feedback and input. Just drop us a line or tweet us!
Last updated: