Within a Samba configuration, is it not advisable to create files on the directory on the local machines themselves? Out setup is like so: Server 1 (where the files reside): /data/shares/app01 Server 2 (mounts the above drive): /data/mounts/app01 If, on Server 1, I create a file: # echo test > /data/shares/app01/test The file is created, but on Server 2, I cannot seem to edit the file as I get the permission denied warning. However, if I mount the /data/shares/app01 directory on Server 1 and write to that directory, I can write to the files from other machines fine. Within smbstatus, it says the file is RDONLY and oplock is NONE when I write to the directory itself and not the mount. I'm wondering if I set things up alright and whether it is bad practice to write to the directory directly? Thank you Ogden
Thank you for your reply. We are using Samba to create a redundant file system for failover between two servers. I am wondering if this is even a recommended use for Samba. For example: app01 ------ /data/shares/app01 (local) /data/shares/app02 (remote) app02 ----- /data/shares/app01 (remote) /data/shares/app02 (local) So we have written our apps to write to both shares - if one goes down, this isn't a bad thing as it will read from the local share. Thank you Ogden On Fri, 3 Oct 2008, Rubin Bennett wrote:> On Fri, 2008-10-03 at 09:46 -0500, Ogden wrote: > > Within a Samba configuration, is it not advisable to create files on the > > directory on the local machines themselves? Out setup is like so: > > > > Server 1 (where the files reside): > > > > /data/shares/app01 > > > > Server 2 (mounts the above drive): > > /data/mounts/app01 > > > > > > If, on Server 1, I create a file: > > > > # echo test > /data/shares/app01/test > > > > The file is created, but on Server 2, I cannot seem to edit the file as I > > get the permission denied warning. > > > > However, if I mount the /data/shares/app01 directory on Server 1 and write > > to that directory, I can write to the files from other machines fine. > > > ?It's not necessarily bad practice, but you have to use care when using > multiple access methods to the Samba shared directory because Unix > filesystem permissions trump Samba perms. > > Example:if you create a file as root (like you did above), then you have > to make sure it's writable as the samba user who accesses the share. > > I.e. if /data/shares/app01/test is 755 and owned by root:root then only > members of the root group would be able to write to that file. > > If you're creating files as root that you expect to write to as another > user, you should expect to adjust ownership and/ or permissions on the > files you create. > > Rubin > > > Within smbstatus, it says the file is RDONLY and oplock is NONE when > > I write to the directory itself and not the mount. > > > > I'm wondering if I set things up alright and whether it is bad practice to > > write to the directory directly? > > > > Thank you > > > > Ogden > > >
On Fri, 2008-10-03 at 11:31 -0500, fixed wrote:> Thank you for your reply. > > We are using Samba to create a redundant file system for failover between > two servers. I am wondering if this is even a recommended use for Samba. > > For example: > > app01 > ------ > /data/shares/app01 (local) > /data/shares/app02 (remote) > > app02 > ----- > /data/shares/app01 (remote) > /data/shares/app02 (local) > > So we have written our apps to write to both shares - if one goes down, > this isn't a bad thing as it will read from the local share. >I don't see any issue with this although there are perhaps better tools for writing to 2 systems simultaneously such as DRBD. Anyhoo, as I said before the issue that you'll need to be watchful of is ensuring that the filesystem permissions remain compatible with how you access the files via the samba shares. A dirty hack may be to mount the local filesystem as a samba share and not access it directly via the filesystem ever. Rubin> Thank you > > Ogden > > On Fri, 3 Oct 2008, Rubin Bennett wrote: > > > On Fri, 2008-10-03 at 09:46 -0500, Ogden wrote: > > > Within a Samba configuration, is it not advisable to create files on the > > > directory on the local machines themselves? Out setup is like so: > > > > > > Server 1 (where the files reside): > > > > > > /data/shares/app01 > > > > > > Server 2 (mounts the above drive): > > > /data/mounts/app01 > > > > > > > > > If, on Server 1, I create a file: > > > > > > # echo test > /data/shares/app01/test > > > > > > The file is created, but on Server 2, I cannot seem to edit the file as I > > > get the permission denied warning. > > > > > > However, if I mount the /data/shares/app01 directory on Server 1 and write > > > to that directory, I can write to the files from other machines fine. > > > > > ?It's not necessarily bad practice, but you have to use care when using > > multiple access methods to the Samba shared directory because Unix > > filesystem permissions trump Samba perms. > > > > Example:if you create a file as root (like you did above), then you have > > to make sure it's writable as the samba user who accesses the share. > > > > I.e. if /data/shares/app01/test is 755 and owned by root:root then only > > members of the root group would be able to write to that file. > > > > If you're creating files as root that you expect to write to as another > > user, you should expect to adjust ownership and/ or permissions on the > > files you create. > > > > Rubin > > > > > Within smbstatus, it says the file is RDONLY and oplock is NONE when > > > I write to the directory itself and not the mount. > > > > > > I'm wondering if I set things up alright and whether it is bad practice to > > > write to the directory directly? > > > > > > Thank you > > > > > > Ogden > > > > >-- ?Rubin Bennett RB Technologies http://thatitguy.com rbennett@thatitguy.com (802)223-4448 ?Think for yourselves and let others enjoy the privilege to do so, too. ~Voltaire