Accessing ownCloud Remotely

Now that you have your NAS and ownCloud installed and ready to share your videos and photos with friends and family but how do they access it?

Click here for video tutorial of this post.

In this article we’ll go through and configure your router be able to access your server remotely so we can not only upload files to share while we are away travelling but also so your friends and family can log in and see what you’ve shared with them!

To do this we will need to able to access our router and setup a few things.

In this example I’m going to use a Netgear router since that’s what I have at home but the process is similar for most home routers.

  • Things we’ll need to get this working:
  • Router Internal IP address
  • Your external IP address
  • Is your external IP static or dynamic?
  • Some patience if you’ve never done anything like this before

Port Forwarding

Let’s get started.

Log into your router using it’s internal IP address.

If you don’t know what it is there are a few ways to find it

  • look on the underside of your router most of the time consumer grade routers will have the default IP and password printed here
  • OR
  • open up “command prompt” on your desktop
    • click on the Windows (start) button – in the search box type in “cmd”
  • in the Command Prompt box type “ipconfig
    • look for default gateway
    • this will most likely be your router’s internal IP address

1a router IPconfig

Once you’ve logged in, depending on the brand of router, many times it will also tell you what your external IP here as well if you can’t see it we’ll use a website to find out what it is later.

1 log into your router

 

What we are looking for is “port forwarding” or something along those lines.

If you can’t figure out how to do it there is an excellent resource called portforward.com which covers many different brands

  • We want to create a new service so click “add custom service”
  • Put in a short descriptive name
  • Select “TCP” for service type
  • For starting and ending port put in the port you used when we created ownCloud in this case it was port 81 (not to be confused with Nas4Free settings)
  • Server ip is the IP address of ownCloud in this case it is 192.168.1.35 (not to be confused with Nas4Free IP Address which is 192.168.1.33)
  • Click apply

2 port forwarding
You should see something similar to this and you should be good. Depending on the router sometimes you have to restart it for it to stick.

3 port forwarding done

That should be it from the internal router side now we need to find out what our external IP is. If you didn’t see it while logged into the router go to this address www.whatsmyip.org this will immediately let you know what your external IP address is.

4 whatsmyip

If you have a static IP address (meaning it never changes) then that’s all you need. Your ISP will be able to let you know for sure. You can test it by checking your IP then turning the modem off and on again and then check the IP again. It’s not a perfect example but many times if you have a dynamic allocated IP this will force your modem to get a new IP.

Testing Remote Access

 

From a computer outside your home open up a browser and put in your browser the following:

https://your_external_ip_here : port_number_here

(note that there is a “:” (colon) between the ip and port numbers with no spaces)

If you have a dynamic IP address using your external IP address can present a problem as your ISP might issue you with a different IP address randomly, to overcome this you can register with sites like no-ip. What these services do is translates your IP address to a name of your choosing so even if your external IP changes the name you choose to use with your account will always stay the same.

Check them out here. No-ip is free to register and use but you will need to update your registration every 30 days just by telling them that you are still using the service (the free service anyway). Even if you have a fixed IP you still may want to look into using this so if you are sharing pictures and videos with family you don’t have to tell them a random set of numbers but something much more people friendly.

Eg. https://32.456.987.243:81 vs https://mycloud.no-ip.org:81 which is easier to remember 🙂

But before it will associate your external IP with your new chosen people friendly name auto magically, we have to enable a service in your Nas4Free so it will check and update on a regular basis behind the scenes.

  • First register with no-ip and choose a hostname and secure password to use.
  • Then in Nas4Free go to

Services -> Dynamic DNS

  • click “Enable”
  • fill out the information you used to register with no-ip.com
  • the host name is the name you chose to use with no-ip.com ie mycloud.no-ip.com
  • save and restart

4a dynamic dns

One final thing before we can access our ownCloud from our external IP or no-ip name.

When you try to access your ownCloud with a different address to the one we setup when we were setting up SSH (the Common Name) you will see a warning.

5 untrusted domain
There’s a button to automatically “add as trusted domain” but I couldn’t get it to work as it doesn’t seem to add the port number correctly in the config file so we have to fix it manually.

Log in using putty and edit the config.php with the following command

  • nano /usr/local/www/owncloud/config/config.php
  • You can add as many names here as you wish just make sure you keep the syntax correct
  • eg. You may want to add a no-ip and an external ip for instance (assuming your ip is static)

5c add domain with port

5d login url

 

Now within ownCloud create users for the people you want to share with and share the folders with them!

You now have your own cloud server with as much space as you need!

Tags:
  • Jeppe Christensen

    Nice guide. Just one question: Is port forwarding safe? I have seen a lot of people warning about it on the owncloud forums, but it seems to be necessary to access an owncloud server outside the local network.

    • @jeppe_christensen:disqus It’s the only way to access most things from the internet so it’s as safe as can be. Best bet is to use the default port 443 which is reserved for https. If it’s not available then use a high port number something that’s not common to minimize the port scanning.

      • Jeppe Christensen

        Thank you for the reply. I have forwarded port 443 to my internal owncloud IP and named the service owncloud. I am not able to externally access my owncloud (https://externalIP:443/owncloud).

        I found your youtube video “Howto Enable SSL on Nas4Free and ownCloud”, will I need to enable SSL for port 443?

        • @jeppe_christensen:disqus port 443 is reserved for secure connections so if you plan to connect remotely you should to enable ssl otherwise your password will be sent in plain text. you can do a port 80 forward without ssl to test the remote connection first.