Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Mount a windows share in FreeBSD/Unix permanently?


Recommended Posts

Posted

I've manage to get it all working with the mounted share to a windows box however when I try and run moodle it brings up time after time a session has timed out message which happens when the permissions on the directory are incorrect I have however made sure that this is not the case with the moodle user having full access to the shared area but it still brings this up do you have any ideas why this may be the case?

 

Wes

Posted

Wes - directory mask errors?

 

FWIW, my (linux) fstab contains lines such as:

//sotonfs/world /mnt/shares/soton smbfs credentials=/root/smb.soton,dmask=777,fmask=666 0 0

 

where /root/smb.soton is (passwords blanked out!)

username = tom

password = #######

Posted
Don't know to be exact... are you sure that the user that apache runs under can access the mountpoint? IIRC, the mount point will need the permissions applied to it before mounting anything.
Posted

webman yep you're right the www user can't write to the share how would I add the unix user to the file permissions of the windows share say the unix box name is unix and the user is www?

 

 

Wes

Posted

To be honest I don't know what the best practice is for this with regards to system permissions and apache needing write access. I'd imagine a chown /mnt/moodledata www would do the trick (while unmounted).

 

*Gets binoculars out to look for Geoff*

Posted

you shouldnt need to change perms after, they can be set during the mount

 

http://samba.org/samba/docs/man/manpages-3/smbmount.8.html

 

see toms post.

 

fmask=

 

sets the file mask. This determines the permissions that remote files have in the local filesystem. This is not a umask, but the actual permissions for the files. The default is based on the current umask.

dmask=

 

Sets the directory mask. This determines the permissions that remote directories have in the local filesystem. This is not a umask, but the actual permissions for the directories. The default is based on the current umask.

Posted
*Gets binoculars out to look for Geoff*

 

No, you need to give effective uid and guid permissions as an option to the mount command.

 

Thus if I had Apache running as uid 'www-data' and guid 'nobody' and wanted it to be able to access '/var/moodledata' which was actually a mounted smbfs share sitting on '\\fserver01\moodledata' accessable with the login name of 'someuser' and a password of 'somepassword',I'd need an fstab line that looked like this:

 

//fserver01/moodledata    /var/moodledata   smbfs    defaults,user=someuser,password=somepassword,uid=www-data,gid=nobody  0       0

 

Care must be taken if the remote share is writeable by anyone else. It may be necessary to set a file mask and/or directory mask (with the fmask= and dmask= options respectively). that enable the 'sticky bit'.

Posted

"Care must be taken if the remote share is writeable by anyone else. It may be necessary to set a file mask and/or directory mask (with the fmask= and dmask= options respectively). that enable the 'sticky bit'."

 

What could happen with this then Geoff? Sticky bit?

 

 

Wes

Posted

Sadly the interaction between Samba and a Windows server isn't always entirely predictable. Depending on the NTFS permissions on the server, you could end up with files the web server can't write too or no-one else can read. You can force the issue with the fmask and dmask options.

 

Alternatively, if you have a recent version of Linux, enable POSIX ACL support for your filesystem. That way, the Linux file permissions model is much closer to how Windows works.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...