Linux - SoftwareThis 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
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.
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.
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.
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.
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
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
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.