I'm trying to mount a webDAV share with this fstab line:

myserverip /media/myserver/ davfs noauto,user,rw 0 0

I have added the secret credentials to ~/.davfs2/secrets.

Also done sudo dpkg-reconfigure davfs2 to allow mounting by non-root users.

This all works fine if I have the following in /etc/davfs2/davfs2.conf:

dav_user        myusername         # system wide config file only
dav_group       myusername         # system wide config file only

But this obviously only works for one user, however if I leave it at the default:

dav_user        davfs2           # system wide config file only
dav_group       davfs2           # system wide config file only

and add my user account to the group davfs2 via

sudo usermod -aG davfs2 myusername

which is successful as shown by the output of groups myusername:

myusername : myusername davfs2

However when I now try to mount the share I get the following error:

/sbin/mount.davfs: user myusername must be a member of group davfs2

So how do I get it to mount by group and why does it not recognize that I’m in the correct group.

up vote 6 down vote accepted

Your running login session might not be updated with the new group yet. Try just calling groups and see if that lists davfs2.

$ sudo useradd foo -M
$ groups
myuser adm cdrom sudo dip plugdev lpadmin sambashare
$ sudo usermod -aG foo myuser
$ groups
myuser adm cdrom sudo dip plugdev lpadmin sambashare
$ su -l myuser
$ groups
myuser myuser adm cdrom sudo dip plugdev lpadmin sambashare foo
  • Yep, noticed my mistake just now... got myself locked out of the sudo, can probably restore that, but is there anyway I can find out what user groups I'm supposed to be part of? – Minos Jul 16 '14 at 11:39
  • also mounting works just fine after a reboot. – Minos Jul 16 '14 at 11:39
  • Maybe create new user and check the groups that he gets put in? also, sudo, of course. – noleti Jul 16 '14 at 11:56
  • 1
    Logout and login helped. – BTR Naidu Sep 30 '16 at 8:35
  • I realize I never explicitly suggested a solution: su -l myuser will also update your current login session – noleti Sep 30 '16 at 8:37

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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