Ubuntu Touch is awesome. Nextcloud is also awesome. Put them together and you have awesome… squared. How cool would it be to have your photos automatically sync to your own Nextcloud sever? Well, you can do it today and here is how.
EDIT DEC 24, 2018 – Important Security Warning before beginning!
Currently as of the time of this post, UBsync is not very secure. The volunteers who forked it are not security experts and the password file is not secure and is in plain text. Therefore, be warned that if your content is of extremely private nature, do not use this blog contents until the app has been properly updated.
However, if you are just trying to move your selfies from your phone to your Nextcloud for safe-keeping, this blog will suffice and hopefully in the next little while we’ll have some helpers in the project to improve the way the password is handed.
Also, there is a way to mitigate some risk so that at least your main NC user/password cannot be high jacked. When you log in to your Nextcloud user settings through a browser and go to ‘Security’ and ‘Create new app password’. Be sure to save this password right away during creation and in a safe place because you can only see the password one time (you can’t come back and see it again).
Once you have this password ready, continue with the blog.
- Make sure that you have a user account and password from a Nextcloud server.
If you don’t have a nextcloud user account, consider strongly hosting your own. You can do this on an unused computer, or using Nextcloudpi on a Raspberry pi, or host a more ‘serious server’.
- In your Nextcloud user directory, create an appropriate directory to put your Ubuntu Touch files in. If you don’t touch anything everything will go into your ‘Photos’ folder by default.
- Make sure you have the UBsync app installed from the OpenStore
- Go to System Settings in Ubuntu Touch
- Go to ‘Accounts’
- Select ‘Add Account’
- Select ‘Nextcloud’
Note: If you try to add an account and it doesn’t respond and take you to the next step, you may need to reboot your device.
- Enter your Nextcloud credentials (from the ‘new app password’ you created at the very beginning)
- Open UBsync App on your Ubunt Touch device
- Select ‘Add a New Account’
- Select ‘allow’ if the prompt is showing the correct username with the correct server address
- Go back to ‘General Settings’ screen of UBsync
- Set your sync frequency.
- Select any other changes you want on this page.
- Go back another screen with the back button top left
- Select the folders on your device that you want to sync to your Nextcloud with the ‘Sync Folders’ option.
The default option will put your Ubuntu Touch photos (unedited) into the /photos directory (which is a default directory when Nextcloud creates a new account) from the following Ubuntu Touch directory
- Add a new folder with the + plus sign on the top right.
Select the directory on your UT device you want to sync. NOTE: This is the tricky part, the big ‘tick’ check mark in the center of the screen is not ‘touchable’ but is trying to direct you to hit the ‘tick’ in the top right menu!
Do the same actions for the remote folder.
If the Folder doesn’t exist you can create a new one easily by just typing it. After creating it, touch it again and hit the ‘tick’ in the top right to make it real.
- When complete, press the back arrow at top left of ‘sync settings’ title.
- Start the sync
Select ‘sync service’ and then the green ‘sync’ button. NOTE: Make sure you are on wifi if you allowed your settings to use both cell phone data and wifi as the sync could be pretty big, especially the first one while it pulls the files from your phone and moves them to nextcloud.
How to Delete an Account un UBsync for Ubuntu Touch
- Go to System Settings in Ubuntu Touch
- Go to ‘Accounts’
- Touch ‘Nextcloud’
- Select ‘Remove Account’ button
That’s it. The account is now removed/deleted.
OpenWRT project is awesome for sure. It’s free software (open source) and it allows you to use your router the way you want, unlike how they usually come out of the box. That said, there doesn’t appear to be a super vibrant community around it (yet) so some stuff is pretty hard to do. I’ve created an OpenWRT English-speaking Telegram Group (for now) in hopes this might help some more community building.
Anyway, here is what you came to this blog for: Making the DDNS service work in your OpenWRT router – in my case, specifically, this is a Dlink DIR-615 router and I’m working with No-ip.com so you may need to adjust a bit according to your service. But if you have NO-IP or haven’t started yet, then maybe just use No-IP?
Let’s do it.
- Get your OpenWRT router setup with OpenWRT. If you happen to have a Dlink DIR-615 – bonus! Here is my blog post to that. If not, it might still be useful or inspiring for helping you get rolling.
- At the top of the router menu options, go to ‘System’ and then ‘Software’ and click the ‘update lists’ button.
This will pull all the possible packages you can install into your router from the community.
- Before installing other packages, install package named “luci-app-ddns.”
It ‘seems’ that this also installs ddns-scripts when you install this which is another one you need so it’s nice it’s automatically installed with this package.
Important Note: If you cannot find packages, or something is strange during package install, you may need to reboot your router to free up some RAM memory. This happened a few times and after rebooting the router I was then able to update the lists correctly.
- Using the same method as the step above, Install the No-IP package for OpenWRT called “ddns-scripts_no-ip_com”
A tab called ‘Services’ should now appear at the top of your router’s menu options because you performed step 3 above. Verify this is good and if some problem, repeat the above steps until you have your tab and possibly you will need to reboot router (see important note above)
- Under new ‘Services’ menu dropdown at top, “Dynamic DNS’ should now be an available option. Here is a link to some No-IP documentation for the client that I found useful. This link here in the ‘OpenWRT configuration’ section was also helpful to me for your reference although it wasn’t No-IP specific.
- In the ‘add’ field at the bottom left, give your service a listing name (I used ‘Noip’ for mine) Then click ‘add’.
- In the DDNS Service provider[IPv4] field, select “no-ip.com” from the dropdown list. Note: even though this is later in the order of fields, do this now.
- Press ‘change provider’ button
- For the ‘Lookup Hostname’ give it your No-IP custom URL without the “HTTPS://” stuff.
- In the “Domain” field, put the same info from step 7 above.
- username = your No-ip username (maybe your email?)
- Password = you guessed it! Your password for the No-IP service
- Under ‘Advanced Settings” I selected “https:// checkip .dyndns .com” from the “URL to detect[IPv4]” field. I found No-IP service wouldn’t work until I chose something from this list. It wouldn’t seem to point No-IP to my router without it…
- ‘Save and Apply’
- At the top right you might (I can’t remember to be honest) see a notification that you have unsaved changes in your router. If so, go and apply those changes to your router.
- Go back to overview list where you started. You should now see your new entry
- Click the ‘enabled’ checkbox
- Press ‘start’ button. You should now see a PID and a number with it and a red icon.
Now, you should be up and rolling and after No-IP has a bit of time to apply the changes your router should now be accessible by the URL you put in step 8 above.
The funny part about this blog is that I spent an entire day searching for how to do this and then I ended up landing on a blog post with the answer… written by ME. in this 2015 blog post Lol or something?
This tutorial assumes you are using Ubuntu and know how to access your terminal and do some basic commands. If not, do a quick study on that before you begin. If you aren’t using Ubuntu on your computer I’m not sure what I can do to help other than encourage you to switch immediately.
This tutorial also assumes that your computer/laptop is plugged directly into the DIR-615 router by ethernet cable and not by wifi. It could probably be done with wifi, but I don’t know and I know it adds an extra layer of complexity I don’t like. So find a cable and plug in to do all this.
1. Download the appropriate image from OpenWRT to your computer.
I got mine by refining a search here.
2. Extract the file into it’s raw ‘.bin’ format.
Mine looks exactly as follows at the time of this writing when it’s sitting in my directory but as versions change and improve this could slightly change be aware:
3. Using your terminal cd (change directory) to the location where the file is you just extracted in step 2.
4. Make sure your computer is set to a static IP address.
If you don’t know how to do this, search it online as I don’t have a quick link to it right now. “How to set static IP address in Ubuntu’ should find something. Make sure that your static IP address you are setting does not conflict with another device on the router, nor with the router itself at 192.168.0.1.
NOTE: After this router is flashed you will need to get rid of this static IP address since it won’t match your new router!
5. Pre-enter the following command into your terminal so you are ready to press enter
curl -0vF email@example.com http://192.168.0.1/cgi/index
Again, the part after the @ symbol in the command above might change depending on the .bin file you are flashing on. This tutorial will likely get old at some point so you may need to swap out a different file name into the command above but the rest should work long term.
6. Power off the router by unplugging the black power cable
Warning. You are about to forever wipe your router’s ‘operating system’ so if you have anything in there you care about this would be the time to get those out!
7. Put pen in the reset button of router and hold it there
8. While still holding reset button, plug in the power cable.
Keep holding the reset button! Don’t let go. The light will be a solid colour (orange, I recall?) but you are waiting for the first flash before executing the next step.
9. As soon as the solid light starts to flash hit the enter key in your terminal and run the curl command you pre-entered in step 5 above
After you hit this command at the perfect moment, things should start to work. When they do, you’ll see some funky html stuff come on the screen that looks like this:
* Hostname was NOT found in DNS cache
* Trying 192.168.0.1…
* Connected to 192.168.0.1 (192.168.0.1) port 80 (#0)
> POST /cgi/index HTTP/1.0
> User-Agent: curl/7.35.0
> Host: 192.168.0.1
> Accept: /
> Content-Length: 3932431
> Content-Type: multipart/form-data; boundary=————————464dbec1925a46d8
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: uIP/0.9 (http://dunkels.com/adam/uip/)
< Content-type: text/html
backup loader Device is Upgrading the Firmware
- Don’t turn the device off before the Upgrade jobs done !