LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 03-06-2015, 06:54 PM   #1
bennypr0fane
Member
 
Registered: Jan 2012
Location: Central Europe
Distribution: Manjaro, Kubuntu
Posts: 171

Rep: Reputation: Disabled
webdav mount is owned by root


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:

Code:
~$ ls -l home/ben/
drwxr-xr-x 22 root root     1184 Mär  1 14:38 Owncloud
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:

Code:
https://webdav.server.org/remote.php/webdav/ /home/ben/Owncloud davfs noauto,user,_netdev,rw 0 0
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...
 
Old 03-08-2015, 01:17 PM   #2
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
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.
 
Old 03-08-2015, 06:12 PM   #3
bennypr0fane
Member
 
Registered: Jan 2012
Location: Central Europe
Distribution: Manjaro, Kubuntu
Posts: 171

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dijetlo View Post
Your user may not be able to mount it
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.
 
Old 03-09-2015, 12:53 AM   #4
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
Hi Ben,
Quote:
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.
 
Old 03-09-2015, 06:15 AM   #5
bennypr0fane
Member
 
Registered: Jan 2012
Location: Central Europe
Distribution: Manjaro, Kubuntu
Posts: 171

Original Poster
Rep: Reputation: Disabled
Code:
~$  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:
Code:
# Allgemein
# <Mountpunkt / WebDAV-URL> <login> <passwort>
# Beispiel
/home/otto/mnt/gmx manfred.mustermann@gmx.de geheimespasswort
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
 
Old 03-09-2015, 09:24 AM   #6
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
Benny
It's always in the logs, babe.
Quote:
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
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.
 
Old 03-09-2015, 05:05 PM   #7
bennypr0fane
Member
 
Registered: Jan 2012
Location: Central Europe
Distribution: Manjaro, Kubuntu
Posts: 171

Original Poster
Rep: Reputation: Disabled
these are lines 1254 through 1263, but I can't understand what she's saying.

Code:
Mar  9 11:56:14 hermann mount.davfs: /sbin/mount.davfs https://oc.benopp.org/remote.php/webdav/ /home/ben/Owncloud -o rw,noexec,nosuid,nodev,noauto,user,_netdev
Mar  9 12:09:01 hermann CRON[3533]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5 ] && /usr/lib/php5/sessionclean /var/lib/php5 $(/usr/lib/php5/maxlifetime))
Mar  9 12:10:10 hermann kernel: [ 4293.388170] perf samples too long (2540 > 2500), lowering kernel.perf_event_max_sample_rate to 50000
Mar  9 12:15:45 hermann kernel: [ 4627.450308] usb 2-1.2: USB disconnect, device number 4
Mar  9 12:15:45 hermann acpid: input device has been disconnected, fd 17
Mar  9 12:15:45 hermann acpid: input device has been disconnected, fd 18
Mar  9 12:17:01 hermann CRON[3671]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Mar  9 12:39:01 hermann CRON[3986]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5 ] && /usr/lib/php5/sessionclean /var/lib/php5 $(/usr/lib/php5/maxlifetime))
Mar  9 13:09:01 hermann CRON[4425]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5 ] && /usr/lib/php5/sessionclean /var/lib/php5 $(/usr/lib/php5/maxlifetime))
Mar  9 13:17:01 hermann CRON[4550]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
 
Old 03-10-2015, 05:38 AM   #8
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
It says it mounted it with no issues...

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).
 
Old 03-10-2015, 05:22 PM   #9
bennypr0fane
Member
 
Registered: Jan 2012
Location: Central Europe
Distribution: Manjaro, Kubuntu
Posts: 171

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dijetlo View Post
It says it mounted it with no issues...
This is today's mount:
Code:
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.
 
Old 05-12-2015, 12:29 PM   #10
andre@home
Member
 
Registered: Oct 2003
Distribution: 2x Debian 8.1 webdav servers
Posts: 93

Rep: Reputation: 44
Under Debian 6 this worked for me:
http://bernaerts.dyndns.org/linux/75...n-webdav-share
My final config file looks like this (link below) as we wanted multiple disks to be mounted automatically.
We called every disk webdav1, webdav2 etc... so that's very clear which disk is involved...
http://gathering.tweakers.net/forum/...01964#36901964
Some owner issues were solved like this:
http://gathering.tweakers.net/forum/...21930#40721930
Sorry the connecting text is in Dutch... but the relevant config part obviously not...
Hope it will help you a little bit, or did you change already to another system?
 
  


Reply

Tags
fstab, mount, webdav



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to mount a Windows shared directory and have mount point be owned by nonroot user Arodef Linux - Software 3 09-14-2009 12:23 AM
root-owned file is able to be deleted with my non-root account win32sux Linux - Security 3 11-18-2008 02:00 AM
How can I have a script owned as root and run as root by a user: setuid? stickey bit? abefroman Linux - Newbie 9 04-19-2008 05:15 PM
Make a file owned by root owned by a user sharpie Linux - Newbie 2 02-26-2004 01:26 AM
vfat mount - all files are 'root' owned, but even root can't -WX d33pdream Linux - General 5 02-28-2003 02:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 06:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration