Automating a mount operation that requires user input

In my case I used the code highlighted by Oli above and then used the trust_server_cert option in the dav2fs config.

Usefull when the server's certificate can't be verified or is even invalid, but you know that you can trust this certificate.

So edit /etc/davfs2/davfs2.conf and add a line that looks like the following:

trust_server_cert        /etc/davfs2/certs/my.selfsigned.cert.pem

This allowed me to mount a self-signed OwnCloud webdav even when the certificate host didn't match.


Wouldn't it just be easier to fix the trust issue and install the certificate?

  1. Download the certificate (thanks to elec3647 on SuperUser)

    openssl s_client -connect HOSTNAME:443 -showcerts </dev/null 2>/dev/null | openssl x509 -outform PEM > certificate.pem
    
  2. Copy the certificate to /etc/davfs2/certs/

    sudo cp certificate.pem /etc/davfs2/certs/
    

That should deal with the problem directly.