Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a webdav share that is automatically mounted at login on my Ubuntu server 14.04 (with Xfce desktop). The problem is that for some reason the share is owned by root and I can't write any files there as my user because I don't have permission:
My question: How can I mount it so that it's owned by my user?
Of course I might just try to change the owner to user, but that seems to be no use because it'll be back to root only at the next reboot.
To make this work, I made this entry in /etc/fstab:
If I understand it correctly, this should make the share available for mounting by users. My user is set to autologin. Then, I have this bash script in the ~/ directory:
Code:
#!/bin/bash
echo -e "myusername\nmypassword\nj"|sudo mount -t davfs https://webdav.server.org/remote.php/webdav /home/ben/Owncloud
It is called by the autostart service of Xfce and mounts the share. The way I see it, this should mean that it actually gets mounted, and hence owned, by my user - but that is obviously not the case...
Your user may not be able to mount it, better to set the permission to 774 and mount it root:users. (then all "users" will have rights through group membership)
Or we could try getting clever with setfacl and acl masks.
You'd think that the user option in fstab would enable it though, right? Anyhow, the share is successfully mounted, but owned by root.
Quote:
better to set the permission to 774 and mount it root:users. (then all "users" will have rights through group membership)
If by setting the permission you mean just running chmod once, I'm not sure that will help. Like I said, for some reason ownership is changed back to root at each reboot - but maybe the permissions won't be?
However, I don't know how to set ownership/permissions at boot! What would I use for that?
Quote:
Or we could try getting clever with setfacl and acl masks.
Never heard of that, would have to investigate. Any good tip where to start?
Last edited by bennypr0fane; 03-08-2015 at 06:13 PM.
user option in fstab would enable it though, right?
It might enable it, but that doesn't mean it's going to work. Mount will give it a try but if the user (Ben) isn't in the right groups (netdev, owncloud, davfs, etc) he lacks the permissions to access the services that mount remote file systems and therefor if never happens though mount will try. Normally, the system would log something like that to /var/log/messages (or in the case of Ubuntu, /var/log/syslog)
Try going to a terminal and running
Code:
grep -Eni "webdav|owncloud|davfs" /var/log/syslog
and see what pops out. If the answer doesn't jump out at you, post the highlights and we'll turn it into a group project.
~$ grep -Eni "webdav|owncloud|davfs" /var/log/syslog
1214:Mar 9 10:59:41 hermann mount.davfs: davfs2 1.4.7
1215:Mar 9 10:59:41 hermann mount.davfs: /sbin/mount.davfs https://my.share.webdav/remote.php/webdav /home/ben/Owncloud -o rw
1253:Mar 9 11:56:14 hermann mount.davfs: davfs2 1.4.7
1254:Mar 9 11:56:14 hermann mount.davfs: /sbin/mount.davfs https://my.share.webdav/remote.php/webdav/ /home/ben/Owncloud -o rw,noexec,nosuid,nodev,noauto,user,_netdev
I'm sorry to say this doesn't tell me anything I can use. I'm just guessing the last line of output tells me what permissions it was actually mounted with?
Maybe I should mention that the computer where I'm trying to mount the share (hermann) is also the server that shares it. That's the reason for the _netdev option in fstab, i.e. to make sure the sharing comes before the mounting attempt.
Between my last post and this one I tried 2 things:
1. chmod -R 774 /home/ben/Owncloud (not sure if that had any lasting effects at all - it spewed out a lot of "invalid argument" errors)
2. I changed my setup to provide the webdav login credentials in the ~/.davfs2/secrets file, like so:
The result is that now the share is NOT mounted after login (which it previously was), but everything is owned by my user (previously root).
Btw These are my user's group memberships.
Code:
~$ groups ben
ben : ben adm cdrom sudo audio dip www-data plugdev netdev lpadmin sambashare davfs2
There's mount making his play for Ownclouds goodies. Wonder what she said? See the line numbers? they were created by the grep 'n' switch. I wanted that for the next bit. If you 'vi' that log with the line number
Code:
vi +1254 /path/to/log/file
You'll open the text editor at the line number you're interested in. If the share isn't mounted, it should tell you why on the next couple lines.
Ben, at this point, I'm going to have to install OwnCloud on one of these VMs and set up an account to test it out. I'll post back when I figure this out (unless some kind soul comes along and straightens us both out).
Mar 10 12:26:50 hermann mount.davfs: /sbin/mount.davfs https://oc.benopp.org/remote.php/webdav /home/ben/Owncloud -o rw
Mar 10 12:26:50 hermann rtkit-daemon[2260]: Successfully made thread 2272 of process 2258 (n/a) owned by '1000' RT at priority 5.
Mar 10 12:26:50 hermann rtkit-daemon[2260]: Supervising 2 threads of 1 processes of 1 users.
Mar 10 12:26:50 hermann rtkit-daemon[2260]: Successfully made thread 2273 of process 2258 (n/a) owned by '1000' RT at priority 5.
Mar 10 12:26:50 hermann rtkit-daemon[2260]: Supervising 3 threads of 1 processes of 1 users.
Mar 10 12:26:50 hermann rtkit-daemon[2260]: Successfully made thread 2275 of process 2275 (n/a) owned by '1000' high priority at nice level -11.
Mar 10 12:26:50 hermann rtkit-daemon[2260]: Supervising 4 threads of 2 processes of 1 users.
The previous one may have been before I changed the setup to make davfs pull the webdav login credentials from ~/.davfs2/secrets.
If this one also says "mounted successfully", then it's lying, bcs like I said, it is NOT mounted after login!
Code:
~$ mount
/dev/sda2 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=ben)
>> no davfs, as you can see...
I can easily mount it from the command line, or by clicking the share in the file manager, but that's not how I want it. The whole point is that it should require no further action after powering on the server!
Quote:
Ben, at this point, I'm going to have to install OwnCloud on one of these VMs and set up an account to test it out. I'll post back when I figure this out (unless some kind soul comes along and straightens us both out).
Thanks for trying this with me! Keep in mind that the webdav share should be mounted on the Owncloud server itself, meaning that mounting must not be attempted before the server starts sharing.
Last edited by bennypr0fane; 03-10-2015 at 05:24 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.