How do I mount a samba directory with write permissions?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
How do I mount a samba directory with write permissions?
I have a samba server sharing my home directory. Works great using windows having read and write permissions. When I mount this samba directory using Mandrake 10.0, I only have read permissions. I have to use root to write. I have done 'chown user:group /mount/point' however after I mount it, root is the owner. How can I have my user have read/write permissions to this samba mount?
If you're mounting the directory via /etc/fstab at boot, which it seems like you are, you need to change the mount setting sin /etc/fstab to give ownership and read write permissions to the users of your choice. Mounts made in /etc/fstab are automatically owned by root and the root group (the permissions of the mount point will change when the partition is mounted), and "others" (which is you if you are not root, nor a member of the root group, which you should not be) will only have read privileges if they have any privileges at all. Definitely not write.
I don't mount samba shares in /etc/fstab, so I don't know the protocol for changing the permissions-- I figure that dimi is probably right on the money pointing you to fmask and dmask in smbmount man page, though.
Thank you muchly. I added the options to fstab and things are working well. I have one problem left.
The permissions on the server are talking effect on the client. I have read/write permissions in the mount folder however all the files inside are owned by 503:503. The uid and gid of the user on the server that I'm logging in as. On Windows, things work seamlessly if you sync your login info with the server. Do I have to do this with Linux as well? If so, is user:group good enough or sync the user ID and group ID as well? On the other hand, using Windows, if I map the drive with another username, I have read/write permissions. Why isn't it the same with Linux?
I am having the identical problem: different UID on server (Mac OS X , Samba) is being honored by Knoppix client. Did you find a solution?
Even though I specify the username in the fstab entry, only resources with "other" permissions can be read or written on the Mac.
I strongly suspect the following is the reason: while the username is the same on both machines, my primary username = UID 1000 in Knoppix but UID 501 on the Mac! I think that when I am logged in as root in KNoppix this distinction doesn't matter, but when when I am in the user account, the Knoppix PC isn't concerned that the username is the same on the Mac's files, it looks at the numeric UID and bases its permissions on that, despite my having dmask=777 and fmask=777 in the fstab entry. Any ideas as to why my dmask and fmask aren't working?
I stopped using Samba for Linux to Linux network file shares, what I do is share the same folder using both NFS and Samba , with NFS used by my Linux boxes and Samba used by any Windows box I happen to bring home ( usually work laptop ). Here is what I used back in the day when I mounted an SMB share on my Linux box ( this is fstab style ):
//<servername>/<sharename> /mnt/<mount folder> smbfs username=<remote user>,password=<remote users password pwd>,uid=<localuser>,gid=<local group id>,umask=0,rw ,user 0 0
Command Line Style:
mount -t smbfs -o username=<remote user>,password=<remote users password pwd>,uid=<localuser>,gid=<local group id>,umask=0,rw //<servername>/<sharename> /mnt/<mount folder>
Where remote user is the name of a user on the box that is sharing the folder ( e.g. hosting the share ),and the remote password is that users corresponding password, the uid/gid is the username/groupname on the box you are mounting the share one, and will be listed as the owner/group after the share is mounted. umask sets default perms to 777 for new files, and rw specifies both read and write ops are allowed through the mounted share.
"user" means the mount point is mountable by any user on the computer where the mount point is, however, you have to suid the "smbmnt" like so "chmod+s /usr/sbin/smbmnt" for it to work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.