{"id":32,"date":"2011-08-19T14:13:01","date_gmt":"2011-08-19T12:13:01","guid":{"rendered":"http:\/\/elkano.org\/blog\/?p=32"},"modified":"2011-09-14T19:12:10","modified_gmt":"2011-09-14T17:12:10","slug":"davfs-mounting-https-webdav-resource","status":"publish","type":"post","link":"https:\/\/elkano.org\/blog\/davfs-mounting-https-webdav-resource\/","title":{"rendered":"Davfs: mounting https webdav resource"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>Here is a simple guide to automaticaly mount a webdav resource in linux. \u00a0In this case we are going to use <a title=\"davfs2\" href=\"http:\/\/savannah.nongnu.org\/projects\/davfs2\" target=\"_blank\">davfs2<\/a> to mount our webdav resource. Davfs is able to mount a WebDAV resource as a regular file system and access it in the same way as others directories in your system. In Ubuntu you have to install davfs2 package:<\/p>\n<p><code><br \/>\n$ sudo apt-get install davfs2<br \/>\n<\/code><\/p>\n<p>Usually, \u00a0 you access to your webdav resource with a username and password. In davfs you can do it automatically putting the username and password in \u00a0<strong>.davfs\/secrets<\/strong>\u00a0file in your home directory. Davfs gets this data and does login for you.<\/p>\n<p>Here is an example of .davfs\/secrets file, \u00a0&#8220;\/home\/user\/webdav&#8221; is the mount point of your webdav resource:<\/p>\n<p><code><br \/>\n\/home\/user\/webdav username password<br \/>\n<\/code><\/p>\n<p>You can put this configuration in \u00a0<strong>\/etc\/fstab<\/strong> file:<\/p>\n<p><code><br \/>\nhttps:\/\/myserver.org\/webdav \/home\/user\/webdav\/ davfs user,noauto 0 0<br \/>\n<\/code><\/p>\n<p>Now, \u00a0you can see this new resource in nautilus file browser and you can mount it automatically.<\/p>\n<p>If you are trying to mount a https resource you have another problem to deal with: \u00a0 the server certificate. If server certificate you are using is sefsigned or from a CA cert that is not known for your system, \u00a0 you are going to see these message when you are trying to mount the webdav resource:<\/p>\n<p><code>You only should accept this certificate, if you can<br \/>\nverify the fingerprint! The server might be faked<br \/>\nor there might be a man-in-the-middle-attack.<br \/>\nAccept certificate for this session? [y,N]\n<\/code><\/p>\n<p>You can&#8217;t accept the certificate permanently, \u00a0so you can&#8217;t mount the resource trough the fstab to be accesible from nautilus, \u00a0because davfs is\u00a0going to be\u00a0waiting\u00a0until\u00a0you enter\u00a0the answer. What you have to do is configure the CA certificate in PEM format on davfs to always be trusted. To do that edit <strong>.davfs2\/davfs2.conf<\/strong> in your home directory or \/etc\/davfs2.conf for system wide and insert this line:<\/p>\n<p><code><br \/>\nservercert \u00a0 \u00a0 \u00a0ca-cert.pem<br \/>\n<\/code><\/p>\n<p>You have to put your CA cert file (ca-cert.pem) on <strong>.davfs\/certs<\/strong> directory.<br \/>\nNow you can mount webdav resource from nautilus without problems.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Here is a simple guide to automaticaly mount a webdav resource in linux. \u00a0In this case we are going to use davfs2 to mount our webdav resource. Davfs is able to mount a WebDAV resource as a regular file system and access it in the same way as others directories in your system. In [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[17,144,18],"_links":{"self":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/32"}],"collection":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/comments?post=32"}],"version-history":[{"count":42,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":151,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/32\/revisions\/151"}],"wp:attachment":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/media?parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/categories?post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/tags?post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}