Quote from manpage of davfs2.conf for mount.davfs:

There is a system wide configuration file /etc/davfs2/davfs2.conf and user configuration files ~/.davfs2/davfs2.conf. When mount.davfs is invoked by root, only the system wide configuration file is read. When invoked by an ordinary user, the user configuration file is read in addition.

If I call mount.davfs with sudo like

sudo mount -t davfs ...

Will this still count as "invoked by an ordinary user" and therefore read my ~/.davfs2/davfs2.conf? Or does sudo make this call "invoked by root" and ~/.davfs2/davfs2.conf will be ignored?

  • I would assume sudo is not "an ordinary user". If you test sudo printenv, you will see that $HOME, etc. are now from root, although other variables are still from the user. Can you just test it? – Sparhawk Jun 19 '19 at 0:30
  • 1
    Isn't the point of sudo running any command as other user (default-ly root) – 炸鱼薯条德里克 Jun 19 '19 at 1:19

To split hairs in order to answer your question:

  • sudo is "invoked by an ordinary user" (you)
  • mount is "invoked by root", since the default action of sudo is to invoke the subsequent command as the root user.

A quick test (assuming you have sudo privileges that let you run id) is:


followed by:

sudo id

In the former, you see your own user; in the latter, you see that id was invoked "as the root user".

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.