Share your files with friends using http links

I thought of making the title of this post “Turn EX2’s web server into your own simple site” but then it would miss the attention of many who would actually benefit from the idea and so rather than stating what this post will help you do, I decided to make the title about the benefit of doing it.

Please note this will require making one teeny-tiny (and very temporary) change to your EX2 via SSH, so if you are not comfortable with using ssh then this is not for you. But the change you will make is completely and automatically reversible, just by restarting your EX2…so it is not as “dangerous” as you might think :slight_smile: Having said that, there are security dangers anytime you open up a server, expecially web servers, to the world - but at the same time, most common security threats against web servers like SQL injection, etc. have been dealt with by EX2’s built-in web server ligttpd. So it is not too risky - but you can be your own best judge. If you choose to proceed with the following steps, you will be assuming all liabilities, should something go wrong - including possible loss of warranty. Also, note that this functionality is obviously not supported by WD’s tech support staff. Okay, onto the good stuff.

Thing is I have never enabled Cloud Access on my EX2 in the 5 months I have had it. I did try it once but it gave me some unauthorized user error - and I had no inclination at the time to pursue it with tech support…since I was content in having my server be used for what I needed it for - an FTP/SFTP server and occasional network storage server. But in recent weeks of playing with Joomla and the web server made me realize, that what I was doing with the web server could easily help many folks who are often bemoaning on this forum the lack of the ability to share something with their friends using a simple http link. Now what I will share here will make any file you wish available to the whole wide world - there will be no privacy…but at the same time since only you will know the file name and no one from outside can see what files (and filenames) you are sharing, realistically the files are only going to be available to those you share the link with (and those that they share it with). Another thing to keep in mind - is that you will be manually building the URLs - so it is easy to do it for a small number of files - you CAN if you want also do it for a large number of files BUT the URLs will need to be generated by YOU…this is a manual (but simple) process.

What you really want to do are three things - but there will be potentially a few other related things to do to get everything working. The two things are:

-  Create a share where you will put your web files

-  Turn on web access from outside world

-  Have EX2’s web server serve files in your share

1)  Create a share to put your web files:  It is as simple as creating the shares you already know how to create using the web dashboard - there are no special steps…just note that it is best to have a one word share name but if you must have two words, use an underscore ( _ ) and not a space for the share name. You may even want to create different shares for different types of files you want to share with - say shares called docs, pics, pdfs, videos, etc. Then setup write permissions to the share, just like you do with any shareensuring that at least your user (i.e. your username) can write to it. After creating the share, just drop the files you would like to share with your friends into that share - again, pleae note, there is technically no privacy or security - anyone who has the link that you give out can view the file.

2)  Turn on web access from outside world:  Go to your web dashboard -> Settings -> General -> Cloud Access -> Dashboard Cloud Access -> set it to On. This makes the web server accessible from outside your home/office network. You do need to ensure that Internet traffic from outside your network can easily come through to the EX2. To do that - you will need to set up port forwarding on your router for port 80 (for regular http access) and port 443 (for https access). You will need to consult your router’s manual for that - that setup is beyond the scope of this guide. There is another alternate way to do this using UPnP settings on the EX2 - but I am not familiar with that - I have always relied on router port forwarding. BTW, the port forwarding works best if you assign a static IP on your router to EX2…so I would strongly encourage you to set that up first so that you never have to worry about it if your router reboots because of a power outage and loses the current internal IP address for EX2.

3)  Have EX2’s web server serve files in your share:  Please note that everytime your EX2 reboots - this step will need to be redone as this setting is lost after reboot. This is the step where you will need to SSH into your EX2.

  • First you will need to turn SSH access on from web dashboard -> Settings -> Network -> Network Service -> SSH -> set to ON if not already on and click Configure to setup ssh password.

  • After that, from a Windows computer use the free tool called PuTTY (google to find download) and from a Mac use the built-in Terminal program to ssh into the EX2. Use the EX2’s internal network IP address (available from dashboard -> Settings -> Network -> Network Profile -> IPv4 IP Address).

  • After connecting to the EX2 via ssh, enter the following commands in succession (ignore any part in parenthesis - they are for notes):

cd /mnt/HD/HD_a2/

ls -la (verify that the directory/share you created is among the list that is displayed)

ln -s /mnt/HD/HD_a2/<share_name> /var/www/<your_share_name_or_another_name_of_your_choice> (replace the items in angled brackets with whatever name you gave to your share…and for the second name it can be the same or adifferent name of your choice EXCEPT web…plase note carefully this second directory name - as that will become part of your URL. If you created multiple shares, then make sure you do this step for each of those shares).

At this point you are all done with the setup. Couple other things you probably want to setup as well if you don’t want to give people URLs that are temporary in nature, like your external IP (can be obtained by googling what is my IP). You can get a DNS name for your IP using a dynamic DNS service. offers a free service but I personally prefer their paid service (make sure to not to auto-renew the service - you can always manually renew). You can basically get a dns name like and assign it to your extrnal IP - and then setup EX2 to auto update that info should your external IP change (Dashboard Settings -> Network -> Network Service -> Dynamic DNS -> ON and Configure). Of course, this is purely optional - you can get it to work just by using your external IP.

NOW to share the URL of the file with friends/family, you need to manually build the URL. Also note that files you share is best to not have spaces in them - if they do, either change the filename to have underscores for spaces OR after you manualy build the URL, use an URL encoding tool (like the one here ->  and use the Encode button after pasting your manualy built URL).

To manually build the URL (link) join together the different parts below separated by plus sign (ensuring there is no space in the final URL):

http:// + external IP address or a dynamic DNS name + / + <second directory name from step 3’s final step above> + / + name of file you are sharing


https:// + external IP address or a dynamic DNS name + / + <second directory name from step 3’s final step above> + / + name of file you are sharing

Try out the URL in your browser and then share it with your friends/family.

If this post helps you, please click on the star under my username on the left of this post to give me a kudo.


Good post, but still would not be required if the dashboard access function was working properly.  See my post on same in this forum.

An alternate and much more secure option to my solution above would be the Web File Viewer functionality in the dashboard…if it worked, which currently is not. Please vote on Vertech1’s idea to get this bug fixed by clicking on the up arrow under his username to the left of his idea here ->

But my post above has its uses too. For times when you want to share a file with a wider audience, say on Facebook, or with a group of friends, but you don’t want to create individual user accounts on your NAS, then you can take advantage of the web server in EX2 following my instructions above.

1 Like

Hi Cybernut,

Thanks for this great writeup. Since you seem to have some experience with the WD NAS products (I just purchased a Mirror about a week or so ago), I was wondering if you could take a look at

Ideally, I would like to be able to do something similar to what dropbox does, get a link for a particular file (or even better, a particular folder), share it with someone and let that be it. I do not want to have to copy this to a new share, if we’re talking about wanting to share a 5GB photo library with someone, copying the entire **bleep** thing to a public share is just not convenient. Giving them the share link WD provides which creates a 5GB .zip is again, not ideal. 

So basically, my questions are:

  1. Is there way to create a web server on the NAS without activating remote access to the NAS’s interface? I’m not really happy about opening up that door.

  2. Can I simply write a php script that receives let’s say a folder name as parameter, parses that folder and creates a media gallery from it? The problem is not writing the actual script, it’s that I don’t know if I can just add a php there and have it be interpreted.



Ice_2k wrote:


So basically, my questions are:

  1. Is there way to create a web server on the NAS without activating remote access to the NAS’s interface? I’m not really happy about opening up that door.
  1. Can I simply write a php script that receives let’s say a folder name as parameter, parses that folder and creates a media gallery from it? The problem is not writing the actual script, it’s that I don’t know if I can just add a php there and have it be interpreted.


A1. As far as I know, the only way to open the web server that’s built in to the firmware is to enable dashboard cloud access. I have realized that enabling that basically behind the scenes causes the Linux’s firewalls to allow requests from outside network. Normally this opening up of firewall would be done with the ifconfig command - but there is no way to do that using the firmware found in the Mirror/EX2/EX4’s firmware. But my experiments have revealed that when I enable the dashboard cloud access, suddenly my web requests from outside network reach the server…and thus it tells me that essentially that GUI option allows the Linux’s firewall to accept incoming requests.

Based on what you are trying to do, I believe this (i.e. enabling dashboard cloud access) would be your best option. You won’t actually be giving the folks a link to get to s specific folder but what would do is setup a share (folder) where you keep all these pics - and assuming you would like all the pics in the share to be visible to a group of folks, you would then create one user to represent that group of folks and grant that user read-privs on that folder. After this, make use of the Web File Viewer App feature of the Mirror (also on EX2/EX4) - this basically allows non-admin users to login to the NAS server via the web interface (same as you use to admin the device) but with only one option - the web file viewer app. And since the user have only been granted readacces to just one share (or more shares) they can ONLY see those folders. andgo in those folders and download the pics…or if you have granted write privs, then they can even upload files to you (or perhaps you could create a separate upload folder for them with write privs, if you so need, while you keep the pics folder read-only from which they can download all the files). Check out the Web File Viewer app yourself by logging in as admin onto the dashboard - Apps -> Web File Viewer. And after you have setup the share and permissions for the user(s) you can check it out yourself by logging in as them. This feature was broken until the latest firmware relase - where only the admin could use this, but finally now non-admin users too can see the folders to which they have been granted access. But for this to work from outside you will need to enable dashboard cloud access. I think this would be closest to what you are looking for.

A2. PHP is already installed on the server. If you are comfy with PHP scripting (I only have dabbled in it and know very little) you can login via SSH, create the simplest phpinfo script (Google if you don’t know how) and toss that script into the /var/www/ directory and then from browser browse to http://<internal_IP_of_Mirror/EX2/EX4>/phpinfo.php. You will learn about all the server’s installed PHP details you need to know. And for this to work you don’t need to enable dashboard cloud access obviously. But if you are looking to enable outside access to the built-in web server, you do need to enable that, as explained in Answer1 above.

I understand the queasiness of opening up the server - but Apache is pretty secure (though sadly they are using a very  dated version of Apache in the latest firmware). As long as you don’t install MyPhpAdmin app I think you’ll be fine (after enabling logging on my EX2’s web server, I see constant probes to get to MyPhpAdmin app - that seems to be THE MOST common probing attempt by far for port 80). Trust me, I have opened opened SSH access to the otuside world (as well as port 80) and the server is constantly getting hammered but it has not been breached yet in the nearly 7+ months that I have opened access. I have only about a month ago implemented logging for port 22 and have started blocking IP ranges in the firewall of my router based on the  IPs logged.

Additional Info: I believe WD’s mobile apps does present galleries of pics (I haven’t used them so can’t comment more), but if you are looking for a computer browser-based gallery presentation of pics you put in a share, then that’s going to require some extra work and some duplicated files. The only way I can think of having a pic gallery is by using a content management system like Joomla or WordPress. Both are available as 3rd-party apps from the dashboard (search for some Joomla-related posts from me in this EX2 sub-forum). I have not toyedwith WordPress but have with Joomla and for creating an image gallery there are plenty of free joomla extensions, etc. (available from to setup simple picture galleries. But yes, you will have to manually create upload the pics into joomla’s image subdirectory so having them in another share won[t be ofany use. That is the only way I can think of having a web-based pic gallery.

If this info helps you, please click the star under my username to the left of this post to give me a kudo.

1 Like

Thanks for the quick reply. Regarding the image gallery, I didn’t know Wordpress/Joomla already have plugins for that, I’ll look into it. As for accessing the actual pictures, without copying them to a different share, I was thinking of creating a link from my photos location to the website folder. I can’t help but think that this would be ridiculously easy for WD to implement… I mean, think about it:

  1. They already have the “right-click on file to get share link” feature which creates  a temporary auth code only valid for the file/folder you selected.

  2. I already has the photo thumbnails generated in the .wdmc folders.

  3. Upon access of the share link, it creates a zip file with the contents of the folder. It would be very easy to instead create a simple html file with a table or something similar containing the thumbnail images and the link to the full-size image in the src attribute.

Since replacing Dropbox is their main selling point, I’m not really sure why this feature doesn’t exist…