Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 06-05-2013, 03:15 PM   #1
Senior Member
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 1,955

Rep: Reputation: 151Reputation: 151
Angry how to create samba mount r/w by any remote user

I have been searching and experimenting for two days trying to figure out the smb.conf and mount.cifs options that will let me mount a directory on host B, cifs mounted on host A that will permit *any* user on host A to have full access without reqiring each and every user to be in the samba password file. No matter what I try, files are created as read-only. Even using the example given in the vanilla smb.conf-sample:

comment = Temporary file space
path = /tmp
read only = no
public = yes

files created by the remote user are 0640. Not only that, but after creating the file the user can no longer read or update it!!!

ls -l on mounted directory /mnt/tmp to remote directory /tmp:

-rw-r----- 1 nobody nogroup 3547 2013-06-05 15:04 that

create mask = 0660
force create mode = 0660

Has no effect. Surely this is a common need. I've googled all over and many forums, including this one, Experts-Exchange, Ubuntu, etc. have threads about this, but they all trail off with no solution determined.

Is there someone at LQ who knows how to do this? Is it even possible with samba?

THX, I really need this.

mount.cifs version 5.6 smbd version 3.5.8
Old 06-06-2013, 02:49 AM   #2
Registered: Nov 2007
Location: Seattle
Distribution: Debian Wheezy & Jessie; Ubuntu
Posts: 334

Rep: Reputation: 60
Try this:

       comment = Temporary file space
       path = /tmp
       public = yes
       writable = yes
       create mask = 0666
       force create mode = 0666
       directory mask = 0777
       force directory mode = 0777
       browseable = yes
mount with
//x.x.x.x/tmp /mnt/tmp cifs iocharset=utf8,file_mode=0777,dir_mode=0777,nounix,rw 0 0 #? add uid=1000,gid=1000

Also make sure the everyone has read,write & execute privileges on folder /tmp
ie chmod 777 /tmp

I am not an expert, this is just a quick suggestion to disable _any_ security. Be aware.


Last edited by propofol; 06-06-2013 at 02:50 AM.
Old 06-07-2013, 04:54 AM   #3
LQ Newbie
Registered: Feb 2013
Location: USSR
Distribution: gentoo
Posts: 15

Rep: Reputation: 0
have the same problem as the ts
Old 06-09-2013, 01:49 PM   #4
Senior Member
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 1,955

Original Poster
Rep: Reputation: 151Reputation: 151
Stefan - thanks for you post. I tried you suggestion. No joy. I believe I have solved the problem, however ...

As I suspected, the resolution is to use NFS, not CIFS. CIFS works great for Windows mounting samba -- it even gives it the 0660/0771 permissions that I specifiy in the smb.conf file. Unix-to-Unix, however, is another story. After doing more googling I've found that numerous people have the same problem trying to cifs mount a remote unix folder on unix. A I mentioned in my original post, none of these threads I've perused have any resolution. I finally tried NFS and it seems to work just fine. Here's my solution:

On the hosting computer: I have a md RAID filesystem (not important to the solution, just for reader FYI) mounted at /mnt/RAID. This filesystem contains several directories, one of which is 'n'.

In the hosting /etc/exports I added the entry:

You can read the exports man page for details on these options, but basically, the 'squash' options cause any connecting user (including root) to re-map to the "anonymous" user's id and group. The anaonuid and anongid options specify what the anonymous user's uid and gid, respectively, will be. These ids correspond to a particular user and group on the remote connecting computers AND, most importantly, they correspond the the user and group of the 'guest' account specified in the local smb.conf. This way, whether a user is connecting from a Windows workstation using samba, or a linux host using nfs, they will all access this mount as the same user/group.

Finally, on the hosting computer, I made /etc/rc.d/rc.nfsd executable and ran:
/etc/rc.d/rc.nfsd start # this is the init script location for Slackware

On the remote, mounting host, I added the following to /etc/fstab, where "ohprsstorage" is the hostname of the hosting computer:

ohprsstorage:/mnt/RAID/n /mnt/n nfs nfsvers=3,rw 0 0

I made /etc/rc.d.rc.rpc executable and ran:

$ /etc/rc.d/rc.rpc start
$ mount /mnt/n

It all seems to be working fine. My user's umask on the remote mounting host is 0007, and files I create there on the nfs mounted directory get created with 0664 (I still want 0660, but no big deal for the moment), and with the userid and groupid specified in the exports file. No 'permission denied' or 0640 permissions making it impossible for me to create or update files. I have group r/w permissions for the 10001.301 user so only linux users with group permission can access the nfs mounted files ... just like a real Unix filesystem!

thoughts, comments, refutations, smirks, etc.?


cifs, samba mount permission

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
samba mount remote linux ust Linux - Newbie 2 08-23-2012 12:51 AM
Trying to create a /home/user for a new user on a remote server Cyberman Linux - Server 1 03-27-2010 06:27 PM
How to mount remote machine DVD ROM and create an iso of that. joykiranr Linux - Desktop 3 09-06-2009 10:47 AM
Remote Mount a Samba Share vcatalano Linux - Security 3 08-16-2008 07:40 PM
samba + remote mount eliufoo Linux - Server 3 07-30-2008 10:06 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:01 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration