LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Windows SMBFS Mount Permissions on Linux (http://www.linuxquestions.org/questions/linux-newbie-8/windows-smbfs-mount-permissions-on-linux-806515/)

clozarks 05-07-2010 10:19 AM

Windows SMBFS Mount Permissions on Linux
 
Command used as root to mount a Windows 2003 server share to Linux Red Hat 4 x86-64 on Dell: mount -t smbfs -o username=user,workgroup=domain.edu,password=password //server.domain.edu/h$ /mnt/test

The mount is successful, but only root can write to the mount. How do I set the permissions on the mount to allow certain users read/write access to the share? I am logged on the Linux server as the same user who authenticated the mount. The user can read write on the Windows server share, but not while loggged into the Linux server.

Thank you,
Curt Swartzlander
DBA

ajeetsinghraina 05-07-2010 11:37 AM

"...Hope these explanation clear your doubt."
Here it goes !!!

Providing Read/Write Access to the Share

Another problem with mounting the Windows share as permanently entered in the /etc/fstab file

Code:

//servername/sharename /mountdirectory smbfs username=windowsuserename,password=windowspassword 0 0
is that only the root user would have read/write access to the share. All other users would have read only access to it. If you wanted read/write access to it for yourself, you need to specify your userid or groupid. That would change the line in /etc/fstab to look like this:

//servername/sharename /mountdirectory smbfs credentials=/home/myhomedirectory/. smbpasswd,uid=mylinuxusername,gid=mylinuxgroupname 0 0

Whatever user and or group you specified in the line would have read/write access to the mounted share. You can use either the user or group name or the user or group numerical ID. Either should work.

If you had several users you wanted to have read/write access to it, create a group and add those users to the group. Then specify just that groupid in the /etc/fstab file. You wouldn't need to specify a userid. The line in etc/fstab would look like this:

//servername/sharename /mountdirectory smbfs credentials=/home/myhomedirectory/. smbpasswd,gid=sambausersgroup 0 0

You can see the man pages on smbmount, smbumount, mount, and fstab for more details.

clozarks 05-07-2010 11:54 AM

Thank you for the reply. If this mount is not permanent, but I only want to mount this as runtime and then remove the mount, can I still grant user permissions to write at runtime? Does the mount need to be in the /etc/fstab file?

Curt

ajeetsinghraina 05-07-2010 11:58 AM

No its not needed if you want to go with temporary entry.
Just run the same command on commandline terminal rather than storing it under /etc/fstab.
No difference at all.

clozarks 05-07-2010 01:10 PM

That did it! Adding the gid and uid to the command changed the permissions on the mount. Thank you for the help! One more question ... how long will the mount persist if I do not unmount? Will it persist until Linux server reboot? And does having a temporary mount (not in fstab) cause any issues (i.e. network performance) on the Linux server?

Thanks
Curt

ajeetsinghraina 05-07-2010 09:31 PM

Code:

how long will the mount persist if I do not unmount?
Until the next reboot

Code:

Will it persist until Linux server reboot?
Yes
Code:

And does having a temporary mount (not in fstab) cause any issues (i.e. network performance) on the Linux server?
No

clozarks 05-10-2010 09:50 AM

One other question ... I noticed that Red Hat Article 1984 "Can an NFS mount be shared out via samba under Red Hat Enterprise Linux?" that there may be issues with sharing a directory that is also an NFS mount point: "Red Hat does not recommend or support this type of configuration, where samba is used to re-export an NFS mounted file system.".

Can you confirm the way I have the smbfs mount point is not an issue? I do not know what re-exporting an NFS mounted file means, and I want to make sure that possible corruption is not a problem because of the way I have the Windows file system mounted on Linux.

Thank you,
Curt

chrism01 05-10-2010 11:33 PM

Basically, there is more than one way of sharing a dir, including nfs & Samba. That quote just means that you should decide on one method and not try to simultaneously share it via nfs & Samba. Check your /etc/exports file for your nfs shares (on the server).


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