LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-28-2009, 05:12 PM   #1
nekawa
LQ Newbie
 
Registered: May 2009
Posts: 16

Rep: Reputation: 1
mount user webpage


having a small issue here. Mount always mounts the directory as 'root' this doesn't seem to be a problem when I access the mounted share as a linux user. but when trying to access the mount via the webserver it fails. How can I fix this? I either need the mount to be mounted as a 'user' if that's possible or else how do I give the webserver permissions to access the same as $USER.

fstab line reads:

Code:
//inmigx150/d /mnt/inmigx_d cifs user=AwakeN,password=thisreallyismypassword,setuid 0 0
 
Old 10-28-2009, 06:30 PM   #2
Robhogg
Member
 
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 97
I believe you will need to add one (or two) extra options to the fstab line:

Code:
//inmigx150/d /mnt/inmigx_d cifs user=AwakeN,uid=user,gid=group,password=thisreallyismypassword,setuid 0 0
The user option gives the user to connect to the share as, while the uid and gid options give the user and group who will own the files in the mounted share. You can also use the file_mode and dir_mode to set permissions, if necessary. See man mount.cifs for more.

Last edited by Robhogg; 10-28-2009 at 06:33 PM.
 
Old 10-28-2009, 06:30 PM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Code:
//cserv.rnbtech.com/d$      /mnt/cserv/d    cifs user,username=administrator,password=*********,gid=users,file_mode=0775,dir_mode=0775
As you can see above, I connect to the windows server as administrator, I am connecting to the share d$, which must be done with administrator rights.

Howewer, in Linux these files are seen as belonging to group users, and all files are accessible rwxrwxr-w. You can also use uid=myuser to make the files appear owned by myuser.

For you it would suffice to use a file mode of 644, and the group users would be fine.

jlinkels
 
Old 10-28-2009, 08:16 PM   #4
nekawa
LQ Newbie
 
Registered: May 2009
Posts: 16

Original Poster
Rep: Reputation: 1
thank you for the quick responses! adding the uid and gid has changed the permissions so it belongs to linux username however this has not solved my issue.

Here's what's going on
webserver is running - root directory for webserver is ~/www .

~/www/laptop is a symbolic link, that links to a CIFS mounted hard drive containing some mp3's. In bash, I can reach the mp3's at /home/user/www/laptop/123.mp3 it exists and I can read it. if I goto http://site.net/laptop/123.mp3 - the mp3 is unaccessable. the webserver is running as user 'www-data' and yes http://site.net/ brings up index.php from ~/www

So long story short my question is how can I make the mount'ed / symbolic'ly linked mp3's accessable by the webserver
 
Old 10-28-2009, 08:51 PM   #5
never say never
Member
 
Registered: Sep 2009
Location: Indiana, USA
Distribution: SLES, SLED, OpenSuse, CentOS, ubuntu 10.10, OpenBSD, FreeBSD
Posts: 195

Rep: Reputation: 37
If I am reading things correctly, you will need to set permissions down the entire path to the file (including the file itself)so that the UID of the webserver has at least read access to the path and files.

So if the path is:
/home/user/www/laptop/123.mp3

and the webserver runs as user:
www-data

then
www-data must have at least read permission for:
/home
/home/user
/home/user/www
/home/user/www/laptop
/home/user/www/laptop/123.mp3



You can not set permissions on a symbolic link so you have to have the permissions correct on the actual directory structure to allow the UID of the webserver have at least read permissions.

Hope this helps.

Last edited by never say never; 10-28-2009 at 08:55 PM. Reason: typo
 
Old 10-28-2009, 09:40 PM   #6
nekawa
LQ Newbie
 
Registered: May 2009
Posts: 16

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by never say never View Post
If I am reading things correctly, you will need to set permissions down the entire path to the file (including the file itself)so that the UID of the webserver has at least read access to the path and files.

So if the path is:
/home/user/www/laptop/123.mp3

and the webserver runs as user:
www-data

then
www-data must have at least read permission for:
/home
/home/user
/home/user/www
/home/user/www/laptop
/home/user/www/laptop/123.mp3



You can not set permissions on a symbolic link so you have to have the permissions correct on the actual directory structure to allow the UID of the webserver have at least read permissions.

Hope this helps.
currently i set the user www-data to belong to the group 'users' then restarted webserver, then after someone replied in this thread i put the uid=user1 and gid=users so the mount belongs to user1:users I would think www-data would be able to access it .

directory permissions are drwxrwxrwx and everything can be accessed up until the mount by the webserver. the permissions for the mp3 are rwxrwSrwx this is not set by me i believe this is default in samba - IE - http://site.net/laptop/123.mp3 is not accessable if i copy that file to .. then i can access it at http://site.net/123.mp3. also I can access the file as user 'www-data' as in if I do 'sudo su www-data' then i can read/copy the file I can't figure out why the webserver can't read it i tried making index.php it works http://site.net/laptop/index.html and it's not accessible it's like the webserver isn't following the symbolic links at all.

think I figured it out there was two issue wrong the webserver didn't like the root directory on a hard disk and the folders were still owned by root had to unmount chown them and then remount. Still don't know why it wouldn't use the root directory of another hard-disk but whatever it works now..
thx again for all the input

back again - thought I'd solved it but to no avail. The directories are browseable, but I can't open up the files. a simple .html file on the smb share does not open by the web-browser it doesn't give the not found error, but the html file comes up blank, mp3 comes up un-download / streamable

Last edited by nekawa; 10-29-2009 at 04:44 PM. Reason: not so solved
 
  


Reply



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 give not-root user ability to mount devices to any mount point??? jdupre Linux - General 8 02-04-2012 10:03 AM
Setting up apache so that user can open their webpage? your_shadow03 Linux - Newbie 4 10-11-2009 11:41 PM
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
help please: mount -t smbfs -a fails as normal user, as root, doesn't mount anything thevic Linux - Networking 11 04-09-2007 03:09 AM
Postfix mail server. (Adding a user from a webpage?) hawkpaul Linux - Software 6 05-30-2003 03:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:57 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