Enable webdav

Strange I do get the login prompt using internal ip eg. http://wdmycloud/Public_ and this is done on the stock unmodified  Apache2 I just reflashed yesterday to the latest v4.

The passwords in the htpasswd file is already MD5 hashed so you can’t use them to login. To get a working user and password, use sqlite3 to view the db file /usr/local/nas/orion/orion.db. See screenshot below, after executing the sql query, the 1st column (device_user_id) is the username and 3rd column (auth) is the password that you need.

@Nazar
Any pointers that I should keep in mind so that I don’t end up bricking my drive while trying set up WebDAV for one of my shares and enable directory listing.
From another thread where you explained how to host a second site on the drive, do I also need to make sure to keep original Apache config in my new config file?
I would also like to use my own username password and not the hashed password from wd.
I’m still on Fw 3.x
Thanks.

You’re still on v3, so you have the flexibility to use apt-get. Why not run owncloud7? There you can run it’s internal webDav.

@Nazar

So i was successfully able to setup webdav on a mybook live using the following steps

MyBookLive: ~ # a2enmod autoindex
MyBookLive: ~ # /etc/init.d/apache2 restart

Create file “wdnas5080” in /etc/apache2/sites-availible with

<VirtualHost *:5080>
ServerAdmin webmaster@localhost

DocumentRoot /shares

Options FollowSymLinks AllowOverride None

Alias ​​/webdav /shares

<Location /webdav/>

Dav On
Options Indexes
Order Deny,Allow
Deny from all
Allow from all
AuthName DeviceUser
AuthType Digest
AuthDigestDomain /webdav
AuthDigestProvider file
AuthUserFile /etc/nas/apache2/auth/htpasswd
AuthGroupFile /etc/nas/apache2/auth/htgroup
Require valid-user

Create the same file but name it “000-wdnas5080” in /etc/apache2/sites-enabled

Add Litsten 0.0.0.0:5080 to ports.conf

MyBookLive :confused: etc/apache2 # a2ensite wdnas5080
MyBookLive :confused: etc/apache2 # /etc/init.d/apache2 reload

However when i try to use them on a mybook cloud it doesnt seem to work.

So i found that the WD cloud like the site config file with a .conf extension. So i created the following:

etc/apache2/sites-available/wdnas5080.conf

/etc/apache2/sites-enabled/000-wdnas5080 -> /etc/apache2/sites-available/wdnas5080

Added “listen 0.0.0.0:5080” in ports.conf

Then:

nas1:/etc/apache2/sites-available# a2ensite wdnas5080
Enabling site wdnas5080.

But when i try to reload apache, i get:

nas1:/etc/apache2/sites-enabled# service apache2 reload
22389 (process ID) old priority 0, new priority 0
AH00526: Syntax error on line 1 of /etc/apache2/sites-enabled/wdnas5080.conf:
cannot occur within section
Action ‘configtest’ failed.
The Apache error log may have more information.
failed!

Any ideas…i would appreciate the help

Thanks

Below should fix your issue. It’s due to existing WD’s config.

  1. Disable your new site config thus removing the symlink, run:

    a2dissite wdnas5080;

  2. Move your config to the conf.d path, run:

    mv /etc/apache2/sites-available/wdnas5080.conf /etc/apache2/conf.d/;

  3. Restart the daemon (required due new listening port 5080), run:

    service apache2 restart;

  4. Access the new webdab, browse:

    http://wdmycloud:5080/webdav/

Enjoy…:stuck_out_tongue:

Thank you Nazar.

That fixed it. So essestianlly on the WD cloud, the only thing i needed to do was to 

1- put a new config file for the new site(webdav) in  /etc/apache2/conf.d/

2- add the listening port in ports.con

3- add a user to for webdav by running:

          htdigest /etc/nas/apache2/auth/htpasswd ‘DeviceUser’ my_webdav_username

where “my_webdav_username” is the same user i use to login to the WD gui dahsboard.

No problem, actually you can skip #2 and add the new listening port at the beginning of your new wdnas5080.conf file.

@Nazar78

In the past you had mentioned that Webdav has a file size limit of just under 4GB.

Is that for a single file transfer or for a total file size upload from the webdav server to a client?

What about folder upload that contains multiple files that total over 4gb ?

 Or is that limit only for a transfer from Windows to a webdav server?

It’s a limit for a single file post/request. Doesn’t affect multiple or chunked post/request.

Hi Nazar78,

Can you explain to me how i can read the login credentials for WebDAV Access?

@Oggel

You can view them in the Sqlite DB:

nazar@TeaNazaR:~# sqlite3 /usr/local/nas/orion/orion.db;sqlite> .header onsqlite> select username as ID, device_user_id as USER, auth as PASS from DeviceUsers;

Login to “http://wdmycloud/Public_/relative-path-to-your-file” with USER and PASS.

See post #10 on this thread for the screenshot.

Thank You.

And how Can I Access the Database? Which Tool do I need? Maybe you can give me a little Instruction how i get access to the DB?

I don’t know much about SQL :frowning:

@Oggel

I already replied with the exact instructions. You need to ssh and run those commands.

OK. And how can i connect via SSH to the MyCloud Mirror? i activated SSH on the dashboard and what next?

@Oggel

You’re on the wrong forum section. This is for WDMyCloud not WDMyCloud Mirror. I do not have a WDMyCloud Mirror and not sure of it’s the same.

Please go to this WDMyCloud Mirror section instead: http://community.wd.com/t5/WD-My-Cloud-Mirror/bd-p/mycloud_mirror

OK Thank you. But there can’t find a tip to connect via SSH. Can you explain to me how it works on a My Cloud? I can try thi on the My Cloud Mirror

@Oggel

Depending on your OS, i.e. for Windows use an app called putty. Then connect to your WDMyCloud Mirror after enabling SSH in the Dashboard. I.e. for Mac from the terminal “ssh root@wdmycloud”. You should be informed of the default password for root when you enable SSH.

Nazar78 wrote:

Below should fix your issue. It’s due to existing WD’s config.

 

  1. Disable your new site config thus removing the symlink, run:

a2dissite wdnas5080;

  1. Move your config to the conf.d path, run:

mv /etc/apache2/sites-available/wdnas5080.conf /etc/apache2/conf.d/;

  1. Restart the daemon (required due new listening port 5080), run:

service apache2 restart;

  1. Access the new webdab, browse:

http://wdmycloud:5080/webdav/

 

Enjoy…:stuck_out_tongue:

Hi Nazar78

Hoping to get some help from you. I’ve been successfully running a second webdav based site on TWO of my WD my cloud drives for several months based on your steps above.

Over the past few days it stopped working. Long story short, its stopped working on both my drives at the same time. 

No firmware udpates on the WD drives.

Tried from multiple devices to access the page but it seems to get redirected as follows:

Page link is: http://WD_IP:51581/web

When i try to open using browsers on my multiple PCs, i get the webdav login, once i enter that I get redirected to “http://WD_IP:51581/UI” . I know the default WD gui is located at that page /UI but on port 80. This displas an error

Not Found

The requested URL /UI was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I have tried from my android phone which i use regaulary to access the webdav share via an android app. That also doesnt work anymore.

Recently i had updated my openwrt router and thought maybe thats causing the issue. Today i connected both drives directly to the PC using static IPs but i get the same problem. 

I’m totally lost now. NO CONFIG HAS CHANGES ON THE WD DRIVES. I have an old mybook live that i had initially setup webdav on long time ago. I powered that on and webdav is working fine on that!!!

Could it be that western digital has some how patched soemthing on the drives silently?


The apache configs are as follows:

nas1:/DataVolume/shares# cat /etc/apache2/ports.conf

If you just change the port or add more ports here, you will likely also

have to change the VirtualHost statement in

/etc/apache2/sites-enabled/000-default

This is also true if you have upgraded from before 2.2.9-3 (i.e. from

Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and

README.Debian.gz

deprecated in apache 2.4

##NameVirtualHost *:80

Listen 80

<IfModule mod_ssl.c>

SSL name based virtual hosts are not yet supported, therefore no

NameVirtualHost statement here

Listen 443

Listen 0.0.0.0:51581

nas1:/DataVolume/shares# cat /etc/apache2/conf.d/wdnas51581.conf 

<VirtualHost *:51581>
ServerAdmin webmaster@localhost

DocumentRoot /shares

Options FollowSymLinks AllowOverride None

Alias /webdav /shares

<Location /webdav/>
Dav On
Options Indexes
Order Deny,Allow
Deny from all
Allow from all
AuthName DeviceUser
AuthType Digest
AuthDigestDomain /webdav
AuthDigestProvider file
AuthUserFile /etc/nas/apache2/auth/htpasswd
AuthGroupFile /etc/nas/apache2/auth/htgroup
Require valid-user

UPDATE:

I found out that i can access files over the above webdav site by pointing directly to a file. However directory listing is not working. TCP capture shows error " Error 405 Method not allowed"

You need this:

<VirtualHost *:51581>

ServerAdmin webmaster@localhost

DocumentRoot /shares

Options +Indexes FollowSymLinks

AllowOverride None

Thanks. I think you have a typo there with a + before the indexes. I tried indexes but it didn’t make any difference. As I mentioned this has been working fine as is before. I was able to see the directory listing of just /webdav. But now I have to do /webdav/share_name
I have numerous apps on my android phone, iPad etc that have book marks to the WebDAV location. Now those bookmarks don’t work anymore…I had to go about updating them to point to the share under WebDAV directory instead…