Koozali.org: home of the SME Server

How to change SAMBA config?

Offline stabilys

  • *
  • 76
  • +0/-0
  • Ah din't do it!!
    • Stabilys Ltd
How to change SAMBA config?
« on: November 11, 2005, 11:21:16 AM »
Help!  :oops:

Sorry to start like that but I'm stuck, and didn't get any replies to my post in August last yet.

Scenario: E-Smith 6 with Yum and patches. Using 6 as need support for Compaq RAID controller missing in 6.01

Require to change smb.conf to support an accounts  database as follows:

Edit the the smb.conf file to add the line :

dos filetimes = Yes
To the file share section.

But I don't understand the templating of the smb.conf. Where should I make this change to be canonical?

Thanks in anticipation,

MeJ
This, too, will pass ;)

Offline Knuddi

  • *
  • 540
  • +0/-0
    • http://www.scanmailx.com
How to change SAMBA config?
« Reply #1 on: November 11, 2005, 09:21:37 PM »
Hi,

Create a file called dos_filetimes in /etc/e-smith/templates/etc/smb.conf/ containing nothing but "dos filetimes = Yes" and do a

# /sbin/e-smith/expand-template /etc/smb.conf

Verify that the /etc/smb.conf contains the entry you wanted.

/Jesper

Offline stabilys

  • *
  • 76
  • +0/-0
  • Ah din't do it!!
    • Stabilys Ltd
How to change SAMBA config?
« Reply #2 on: November 12, 2005, 01:54:43 AM »
Thank you knuddi:

just what I wanted  :-)

MeJ
This, too, will pass ;)

Offline raem

  • *
  • 3,972
  • +4/-0
How to change SAMBA config?
« Reply #3 on: November 13, 2005, 12:18:20 AM »
> Create a file called dos_filetimes in /etc/e-
> smith/templates/etc/smb.conf/ containing nothing
> but "dos filetimes = Yes" .......

To be consistent with the way custom templates should be used, you should really add that fragment to
/etc/e-smith/templates-custom/etc/smb.conf

then do
/sbin/e-smith/expand-template /etc/smb.conf
...

Offline stabilys

  • *
  • 76
  • +0/-0
  • Ah din't do it!!
    • Stabilys Ltd
How to change SAMBA config?
« Reply #4 on: November 13, 2005, 02:53:18 PM »
Hi all,

and thanks for the help. However, this does not quite work. This does indeed insert the necessary string in the generated smb.conf file, but not in the correct section.

It needs to be applied to the ibay shares, and I don't understand the parsing of the 90ibays fragment (where I think it should be put?) in the templates/smb.conf section.

I tried adding the fragment as 91dos-filetimes but that just adds it right at the end of the smb.conf file.

Any hints? I don't really want to mess with the 90ibays fragment as I don't understand it and it's not canonical (though obviously that might work). (I really find this template system irritating albeit I know it has benfits, but a two minute job turns into three weeks of headbanging - my lack of understanding of course)

TIA,

JR



Quote from: "RayMitchell"
> Create a file called dos_filetimes in /etc/e-
> smith/templates/etc/smb.conf/ containing nothing
> but "dos filetimes = Yes" .......

To be consistent with the way custom templates should be used, you should really add that fragment to
/etc/e-smith/templates-custom/etc/smb.conf

then do
/sbin/e-smith/expand-template /etc/smb.conf
This, too, will pass ;)

Offline raem

  • *
  • 3,972
  • +4/-0
How to change SAMBA config?
« Reply #5 on: November 13, 2005, 09:32:41 PM »
stabilys

> I don't really want to mess with the 90ibays
> fragment as I don't understand it and it's not
> canonical (though obviously that might work).
>(I really find this template system irritating
> albeit I know it has benfits...

And that IS exactly the reason the templating system is good and should be used as intended.

If you make chnages in
/etc/e-smith/templates/etc/smb.conf/fragmentname

and stuff things up, then you have potentially corrupted your original template fragments. You may or may not be able to get them back to the way they were ! Apart from that your server will be in an unusable state for a while until you resolve the problem.


If you copy the required fragments to
/etc/e-smith/templates-custom/etc/smb.conf/...

then expand the template,
and you then find that you have stuffed something up, then you simply remove the newly added fragment or changes, expand, and your server is back to its original working condition.
Note the custom templates override the settings in the standard templates. If there are no custom templates, then the standard ones will apply.

If you think the 90ibays fragment is the correct place to add your changes, then do so, but in
/etc/e-smith/templates-custom/etc/smb.conf/90ibays

Experiment away !
...

Offline stabilys

  • *
  • 76
  • +0/-0
  • Ah din't do it!!
    • Stabilys Ltd
How to change SAMBA config?
« Reply #6 on: November 13, 2005, 11:15:04 PM »
Quote from: "RayMitchell"
stabilys

> I don't really want to mess with the 90ibays
> fragment as I don't understand it and it's not
> canonical

And that IS exactly the reason the templating system is good and should be used as intended.

(if) you then find that you have stuffed something up, then you simply remove the newly added fragment or changes, expand, and your server is back to its original working condition.


I understand the templating system Ray, but I manage to achieve equal rollback capability in Debian just with RCS and textfiles.

Quote from: "RayMitchell"
stabilys
If you think the 90ibays fragment is the correct place to add your changes, then do so, but in
/etc/e-smith/templates-custom/etc/smb.conf/90ibays

Experiment away !


But that's the problem. I don't want to experiment on a production server, and I don't understand where to put the fragment I need to achieve the results I want. I don't understand the 90ibays code. All I want to do is add a simple parameter.

Any ideas, anyone?

TIA
This, too, will pass ;)

Offline raem

  • *
  • 3,972
  • +4/-0
How to change SAMBA config?
« Reply #7 on: November 13, 2005, 11:31:05 PM »
stabilys

> I don't want to experiment on a production server..

That's what test servers are for !
...

Offline stabilys

  • *
  • 76
  • +0/-0
  • Ah din't do it!!
    • Stabilys Ltd
How to change SAMBA config?
« Reply #8 on: November 14, 2005, 12:18:11 PM »
Can *anyone* point me to documentation of how the smb.conf file is built by the various fragments in the templates?

Thanks!
This, too, will pass ;)

Offline raem

  • *
  • 3,972
  • +4/-0
How to change SAMBA config?
« Reply #9 on: November 14, 2005, 04:12:09 PM »
stabilys

Read the code in the template fragments, that's what creates smb.conf, but I think you know that.
As your requirement is non standard, you will have to work out where your changes should go.
See
http://no.longer.valid/phpwiki/index.php/Customizing
...

Offline Alex Schaft

  • ****
  • 97
  • +0/-0
Building of smb.conf by templates
« Reply #10 on: November 14, 2005, 07:08:51 PM »
Hi,

The wiki page contains a good information, but briefly, the file is built out of the fragments in templates-user, templates-custom, and templates, with user override custom, and custom override plain templates.

The "SME" way of adding your change is the following:

1. Store in the database which ibay should have dos file times.

/sbin/e-smith/db accounts setprop music DosFileTimes enabled

2.

Add the following lines inside the foreach loop, after the [$key] definition.

    if (defined($properties{'DosFileTimes'}) && $properties{'DosFileTimes'} eq 'enabled') {
        $result .= "dos filetimes = yes\n";
    }

What this does is query the database for the ibay that's being built for the DosFileTimes key, and see if it's enabled. If it is, the line "dos filetimes = yes" is added to the $result var, which is used by the expand-template system to write the ibay entry.

HTH's
Alex
......

Offline stabilys

  • *
  • 76
  • +0/-0
  • Ah din't do it!!
    • Stabilys Ltd
How to change SAMBA config?
« Reply #11 on: November 14, 2005, 09:28:19 PM »
Thank you both for all your help - once I've figured it out exactly (and tested it) I'll post (and/or add to Wiki) exact details of the tested alteration in case anyone else needs it.

MeJ
This, too, will pass ;)

Offline percheron

  • *
  • 17
  • +0/-0
Re: Building of smb.conf by templates
« Reply #12 on: December 07, 2005, 01:37:39 PM »
Quote from: "Elax"
Hi,

The "SME" way of adding your change is the following:
...
Add the following lines inside the foreach loop, after the [$key] definition.

    if (defined($properties{'DosFileTimes'}) && $properties{'DosFileTimes'} eq 'enabled') {
        $result .= "dos filetimes = yes\n";
    }



Can anyone please tell me exactly where in the 90ibays template the above lines of code should be placed in SME 7.0b8 and what, if anything, should be modified for 7.0. Here is the 7.0 90ibays template:
-----------------------------------
{
    # process all information-bay directories

    use esmith::AccountsDB;
    my $adb = esmith::AccountsDB->open_ro();

    foreach my $ibay ($adb->ibays)
    {
   $OUT .= esmith::templates::processTemplate (
       {
      MORE_DATA => {
         ibay => $ibay,
          },
      TEMPLATE_PATH => "/etc/smb.conf/ibays",
      OUTPUT_TYPE => 'string',
       });
    }
}
-----------------------------------

Thanks,
jim

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Building of smb.conf by templates
« Reply #13 on: December 08, 2005, 04:34:32 AM »
Quote from: "percheron"


Can anyone please tell me exactly where in the 90ibays template the above lines of code should be placed in SME 7.0b8 and what, if anything, should be modified for 7.0.


Have a look at the files in /etc/e-smith/templates/etc/smb.conf/ibays/. They're used multiple times - once for each i-bay, and interpolated into /etc/smb.conf. Otherwise they're just like any other template fragment.