WebDAV - Ubuntu Server 12.04.4 - Windows7 Rig

Discussion in 'Server Operation' started by [email protected], Feb 26, 2014.

  1. danhansen@denmark

    [email protected] Member HowtoForge Supporter

    Building a webserver to test an learn php5 and SQL. And I want to edit/work directly on the files in 2-3 webdir/website from a desktop (windows7 rig).
    Followed these 2 ToDo's:

    I know the Webdav ToDo is for a Ubuntu Server 10.04, but I compared the commands to commands from Ubuntu Help, and couldn't find any differences.
    This is a Todo for Ubuntu Server 12.04: http://www.qazxdr.com/setting-up-webdav-server-on-ubuntu-12-04/

    Webdav works just fine, I checked using cadaver, and I was able to map the directory on my windows7 desktop. But I can't copy a file to the mapped /webdav !? I mapped with the username I created by "htpasswd -c /var/www/web1/passwd.dav username" And the right password of course! The mapping works, the copying to the mapped directory doesn't

    A. It's a clean installation of Ubuntu Server 12.04 and then Apache2/MySQL/PHP5 according to the Todo.
    B. The username I used for the webdav user /passwd.dav is NOT the administrator username of the Ubuntu Server!
    C. I created a little file called info.php in the /var/www/web1/web directory with VI from Putty/SSH. Then I checked the content of the mapped /serverip/webdav/ and the file was there! I could se it, but not open, not execute, not copy, not anything! It must have something to do with rights somehow. Shall the webdav user not be a member of www-data?? This is what I did according to the tutorial:
    chown root:www-data /var/www/web1/passwd.dav
    chmod 640 /var/www/web1/passwd.dav

    The problem:
    1. I'm not allowed to copy anything to the mapped directory
    2. Like in the ToDo, I can't see any directory. But this is maybe because the sample in the Todo http://www.howtoforge.com/how-to-set-up-webdav-with-apache2-on-ubuntu-10.04-p2 is a sample AFTER something has been copied to the mapped directory!? I have read the ToDo again and again, I can't se why anything should be in the mapped directory /webdav . I haven't copied anything in there yet ;)

    Here's the content of /etc/apache/sites-available/default
    NameVirtualHost *
    <VirtualHost *>
            ServerAdmin [email protected]
            DocumentRoot /var/www/web1/web/
            <Directory /var/www/web1/web/>
                    Options Indexes MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            Alias /webdav /var/www/web1/web
            <Location /webdav>
               DAV On
               AuthType Basic
               AuthName "webdav"
               AuthUserFile /var/www/web1/passwd.dav
               Require valid-user
    I noticed the passwd.dav file exist in /var/www/web1 and the directory "web" is present too!

    Is it because I gave the directory the wrong rights? chmod 640 /var/www/web1/passwd.dav. I followed the tutorial to the letter ;)

    Is it permissions maybe?
    Maybe: chmod 664 -R /var/www/web1/web ????
    Or is 660 the right one? writing rights for the group??
    Please keep in mind, I followed the tutorial...

    Or, which directory do you set permissions? /webdav ? or /var/www/web1/web ? I'm not very strong in symlinks :eek:
    Last edited: Feb 26, 2014
  2. danhansen@denmark

    [email protected] Member HowtoForge Supporter

    Can this be it ????


    Any guru's out there?
    Could this be the answer? To add a user to the group www-data? The user "username" which was created in /passwd.dav? I read in my Ubuntu book that this is the way to add a user to a group, and translated into my situation this should be it! But is it enough? I've been working with NT servers in the future, so I'm naturally afraid of users, groups and permissions :eek:

    # adduser <username> www-data

    I would like someone to confirm this, because I've read to add a user to a existing group it is done with a special command. Is this -G ? -g ? -a ?
    So, to add a new user to an existing group is this done like this?

    # useradd -g www-data <username>

    Permissions for /var/www/web1/:
    [email protected]:/var/www/web1# ls -lart
    total 16
    drwxr-xr-x 3 root root 4096 Feb 24 19:25 ..
    drwxr-xr-x 3 root root 4096 Feb 24 19:27 .
    -rw-r----- 1 root www-data 42 Feb 24 19:27 passwd.dav
    drwxr-xr-x 2 www-data root 4096 Feb 26 16:44 web

    Permissions for /var/www/web1/web/:
    [email protected]:/var/www/web1/web# ls -lart
    total 12
    drwxr-xr-x 3 root root 4096 Feb 24 19:27 ..
    -rw-r--r-- 1 root root 21 Feb 26 16:44 info.php
    drwxr-xr-x 2 www-data root 4096 Feb 26 16:44 .

    Any suggestions?
    Last edited: Feb 26, 2014
  3. danhansen@denmark

    [email protected] Member HowtoForge Supporter

    Hi someone...

    I add'ed the user, same username as in /passwd.dav of course, using this command:

    # useradd -g www-data "username"

    And "username" is now a member of the group "www-data"! The permissions for the directory /var/www/web1/web is:

    [email protected]:/var/www/web1/web# ls -lart
    total 12
    drwxr-xr-x 3 root root 4096 Feb 24 19:27 ..
    -rw-r--r-- 1 root root 21 Feb 26 16:44 info.php
    drwxr-xr-x 2 www-data root 4096 Feb 26 16:44 .
    [email protected]:/var/www/web1/web#

    Ubuntu rocks! Yes, I know, but my god, it's difficult just to get a dance o)
  4. danhansen@denmark

    [email protected] Member HowtoForge Supporter


    This worked. By adding the username to the group www-data I am now able to create folder and copy to the directory. But, and there's allways a but isn't there?

    The "But":

    It's just a shortcut, it's not a real mapping with drive letter, which means you can't open the html files in bluefish.

    Trying to map it as a drive letter instead of as a shortcut, nothing worked. Tried the "https://192.168.x.xxx/webdav" but no change. Tried \\ instead no difference..

    Anybody out there who knows:
    A. about webdav and mapping in Windows7 or Ubuntu Desktop.
    B. how to open files i bluefish a webdav shortcut in windows 7

    Non of these works:
  5. danhansen@denmark

    [email protected] Member HowtoForge Supporter

    SOLVED! Map network drive/WebDAV in Windows 7

    Hi myself,

    Yes, we succeeded! Me & Myself ;)
    Well, I'm a little tired talking to myself, but please don't tell my other "me" this !!!

    And this mapped WebDAV share is so much easier to use. It's faster actually and it's like handling a normal mapped network drive.

    Now I can also edit the files directly in Bluefish! This was the reason I had to find the solution.

    The solution is
    1. To change the service "webclient" under services in windows 7 to run automaticly.
    2. To download this hotfix (it's not enough, you have to do more!) click here: http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=15123
    3. To edit registry in windows, do this: find "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters", and then select "BasicAuthLevel" if it doesn't exist, create it, set value to "2" (it's set to 1 if it exists!)
    4. Reboot
    5. Right click "My Computer", select drive letter, enter URL. Enter URL/path to map network drive this way: \\server_or_ip\webdavshare --> type username and password and VOILA! (e.g. \\\webdav )

    And here's the proof. You can see the lousy standard WebDAV shortcut and you can see the mapped Webdav share ;)
    Well, no you can't, because I can't upload the image ;( Well, you get the idea I'm sure ;)

    I will select notification if someone should need help on this issue. Just leave a remark and I will appear (ASAP:))
    Last edited: Feb 27, 2014

Share This Page