MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Kindle Developer's Corner (https://www.mobileread.com/forums/forumdisplay.php?f=150)
-   -   Mini WebDAV HowTo (https://www.mobileread.com/forums/showthread.php?t=189470)

knc1 08-30-2012 11:06 AM

Mini WebDAV HowTo
 
The WebDAV services being provided by knetconnect.com have so far focused on browser access.
Browser access because that works on Linux, Mac, and Windows.

For users running Linux, the WebDAV remote directory may be mounted into your filesystem tree.

The following is adapted from:
http://www.thetechrepo.com/id=537

In the following, only the sub-domain, domain, folder, username, password, uid and gid have been changed from that used by the current members.
(I left the puncuation alone.)

So substitute your actual values in the following example for:
Domain: Konnect.con
Folder: ourbox
Remote username: myname
Remote password: mypass
LocalUID: itsme
LocalGID: itsme

Install the davfs2 package for your distribution.
That is the package's most common (Debian/Ubuntu) name.
It should be available in all Linux distributions.
If not found in your distribution and you are using an rpm package based system, search rpmfind.net for davfs2. There where 58 flavors to choose from there yesterday.

Make a local directory to serve as a mountpoint:
Code:

mkdir -p /home/itsme/ourbox
The new directory does not have to be in your home directory and its name need not be the same name as the remote folder. Use what makes sense to you on your system.

You will need the UID and GID names of that directory. Use stat to find them:
Code:

stat ourbox
  File: `ourbox'
  Size: 4096          Blocks: 8          IO Block: 4096  directory
Device: 97eh/2430d    Inode: 494005      Links: 2
Access: (0775/drwxrwxr-x)  Uid: ( 1000/  itsme)  Gid: ( 1000/  itsme)
Access: 2012-08-30 07:54:32.000000000 -0500
Modify: 2012-08-30 07:54:32.000000000 -0500
Change: 2012-08-30 07:54:32.000000000 -0500

For each WebDAV remote, you need to alter two system configuration files.

With a text editor, as the "superuser", edit /etc/davfs2/secrets by appending the line:
Code:

sudo nano /etc/davfs2/secrets

Append a line, with substitutions of the fields shown above, to read:
http://Konnect.con/ourbox myname mypass

With a text editor, as the "superuser", edit /etc/fstab by appending the line:
Code:

sudo nano /etc/fstab

Append a line, with substitutions of the fields shown above, to read:
http://Konnect.con/ourbox    /home/itsme/ourbox    davfs    noauto,users,uid=itsme,gid=itsme 0 0

That is all of the one-time setup required.

To use the remote directory as if it was part of your system file tree:
(assuming you put the folder in your home directory as shown above)
Code:

sudo mount ~/ourbox
You also need to umount it when done and before re-booting.
davfs2 does a lot of local caching, it takes it a noticable amount of time to sync with the remote.

The service on knetconnect.com implements file locking (as MySQL locked transactions).
You should not have problems mentioned on the 'net associated with WebDAV systems that do not support file locking.

Remember that this is a SHARED remote directory and the only controls (other than access control) is common sense.
So make a sub-directory of the shared directory for things specific to your use (like putting your EclipseCDT workspace on it).

Other than your read/write speeds being limited by your Internet connection (KnetConnect.com is on 10Gbs fiber, IPv4/IPv6) this mounted remote will work the same as any of your local directories.
It will be a rare program that can tell the difference between the local and remote directories.

This service does not support all of the fancy features of a true "Cloud", such as www.box.com, but it doesn't have the monthly fees either.

Yes, Virgina, you can do the same on your Kindle if you don't mind changing system file contents.

qlob 08-30-2012 11:29 AM

Thanks! I think I'll stick with using Nautilus for now.....

knc1 08-30-2012 11:35 AM

Quote:

Originally Posted by qlob (Post 2203027)
Thanks! I think I'll stick with using Nautilus for now.....

No problem.
It just describes another way of using it.
If using a browser works for you, do it that way.

twobob 08-30-2012 05:25 PM

*intrigue* I too connect with Nautlius but this is great info! Thanks

knc1 10-03-2013 01:24 PM

Failure message notes for dav2fs setup
 
Using an intentionally mis-configure WebDav 'kloud' -

Bottom line: It makes a difference if the server is set to auto-strip the 'www.' from the URL (KnetConnect.com is, others of mine are not).

Code:

core2quad ~ $ mount ~/k3broke
/sbin/mount.davfs: program is not setuid root

Code:

core2quad ~ $ sudo chmod u+s /sbin/mount.davfs
Code:

core2quad ~ $ mount ~/k3broke
/sbin/mount.davfs: user mszick must be member of group davfs2

Code:

core2quad ~ $ usermod -a -G davfs2 mszick
usermod: cannot lock /etc/passwd; try again later.

Code:

core2quad ~ $ sudo usermod -a -G davfs2 mszick
{log out, log back in}

Code:

core2quad ~ $ id
uid=1000(mszick) gid=1000(mszick) groups=1000(mszick),4(adm),20(dialout),24(cdrom),46(plugdev),116(lpadmin),118(admin),125(sambashare),128(vboxusers),133(davfs2)

Code:

core2quad ~ $ mount ~/k3broke
/sbin/mount.davfs:/home/mszick/.davfs2/davfs2.conf:24: system option in user configuration file
/sbin/mount.davfs: mounting failed; the server does not support WebDAV

Grab favorite editor and in the **user** davfs2.conf file:

Before:
Code:

# dav_user        davfs2            # system wide config file only
# dav_group      davfs2            # system wide config file only
ignore_home      kernoops,distccd  # system wide config file only
# kernel_fs      fuse

After:
Code:

# dav_user        davfs2            # system wide config file only
# dav_group      davfs2            # system wide config file only
# ignore_home      kernoops,distccd  # system wide config file only
# kernel_fs      fuse

Code:

core2quad ~ $ mount ~/k3broke
/sbin/mount.davfs: mounting failed; the server does not support WebDAV

Time to edit /etc/fstab (as 'root')

Code:

# /etc/fstab: static file system information.
#
# <file system>                                <mount point>  <type>  <options>                      <dump>  <pass>
 - - - - snip other system mounts - - - -
 
http://drpbox.knetconnect.com/k3broke  /home/mszick/k3broke    davfs  noauto,users,uid=mszick,gid=mszick 0 0

Which is known to be (intentionally) broken.

Code:

# /etc/fstab: static file system information.
#
# <file system>                                <mount point>  <type>  <options>                      <dump>  <pass>
 - - - - snip other system mounts - - - -
 
http://drpbox.knetconnect.com/k3broke  /home/mszick/k3broke        davfs  noauto,users,uid=mszick,gid=mszick  0  0
http://www.knetconnect.com/kpw2        /home/mszick/kindle/kpw2dav davfs  noauto,users,uid=mszick,gid=mszick  0  0

Ensure mount point exists:

Code:

core2quad ~ $ mkdir -p kindle/kpw2dav
Give the new entry a try:

Code:

core2quad ~ $ mount kindle/kpw2dav
Please enter the username to authenticate with server
http://www.knetconnect.com/kpw2 or hit enter for none.
  Username: ^C

To save the authentication information on your local machine . . . .

Directions are part of the configuration file.
You must be 'root' to read or write to this file.

Code:

**THIS ONE IS WRONG**
core2quad ~ $ sudo less /etc/davfs2/secrets
- - - - snip directions - - - -
# uuuuuu == your WebDav username
# pppppp == your WebDav username's password
http://drpbox.knetconnect.com/k3broke uuuuu1 ppppp1
http://www.knetconnect.com/kpw2 uuuuu2 ppppp2

Code:

**THIS ONE IS WRONG**
core2quad ~ $ mount kindle/kpw2dav
/sbin/mount.davfs: Mounting failed.
301 Moved Permanently

Ah, so - problem found - web server on this domain is stripping 'www.'

Code:

core2quad ~ $ sudo less /etc/davfs2/secrets
- - - - snip directions - - - -
# uuuuuu == your WebDav username
# pppppp == your WebDav username's password
http://drpbox.knetconnect.com/k3broke uuuuu1 ppppp1
http://knetconnect.com/kpw2 uuuuu2 ppppp2

Code:

core2quad ~ $ mount kindle/kpw2dav
core2quad ~ $ cd kindle/kpw2dav
core2quad kpw2dav $ ls -l
total 0
drwx------ 2 mszick mszick 0 2013-10-03 11:11 lost+found
drwxr-xr-x 2 mszick mszick 0 2013-10-02 13:57 pw2 dumps
drwxr-xr-x 2 mszick mszick 0 2013-10-02 13:39 Things_to_knc1
drwxr-xr-x 2 mszick mszick 0 2013-10-02 22:21 Things_to_NiLuJe
drwxr-xr-x 2 mszick mszick 0 2013-10-02 13:39 Things_to_npoland
drwxr-xr-x 2 mszick mszick 0 2013-10-02 22:22 Things_to_twobob
core2quad kpw2dav $


NiLuJe 10-03-2013 01:42 PM

Ha! So that was the reason for the 301 ;). Thanks :).

knc1 10-03-2013 02:02 PM

Quote:

Originally Posted by NiLuJe (Post 2643970)
Ha! So that was the reason for the 301 ;). Thanks :).

Yes -
I will have strong words with that web-master, next time I see him in the mirror.

knc1 10-04-2013 09:59 AM

Kpw2 Mini-Kloud
 
:end:Both NiLuJe and I have experienced kernel filesystem deadlocks when using the davfs2 driver on series 3.x kernels.
Users might want to use that as a read-only driver until the problem is found.

NiLuJe and I both use Konqueror (yes, you can install Konqueror on a non-KDE desktop system).
Note: Konqueror expects the scheme to be webdav:// rather than http:// but other than that, it 'just works'.

npoland is using whatever thingy that comes standard with MacOSx (Apple has great built-in support for WebDav).

twobob 10-04-2013 10:11 AM

errr. I tried earlier (The 1st time I woke up) but was unable to remember my password.
3.8 kernel here.

However the last time I tried my computer kept locking up (as you know)

knc1 10-04-2013 10:21 AM

Quote:

Originally Posted by twobob (Post 2645015)
errr. I tried earlier (The 1st time I woke up) but was unable to remember my password.
3.8 kernel here.

However the last time I tried my computer kept locking up (as you know)

Well, now we know why your machine kept locking up - the WebDav mount.

You might have to stick with your favorite browser that does WebDav (Nautilus? Konqueror? Something else?)

Will send you your credentials again - your going to want to see that tool chain and reference manuals (at least).

twobob 10-04-2013 11:02 AM

right.

I'll go in via web for now. it was Nautilus / (pacmanFM?) I think on mint


All times are GMT -4. The time now is 05:53 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.