Koozali.org: home of the SME Server

Samba includes - smb.conf.%m

Offline bloodshoteye

  • *****
  • 232
  • +0/-0
  • Grateful thanks to SME devs
Samba includes - smb.conf.%m
« on: March 20, 2008, 01:38:03 PM »
Hi all
I've looked thru the forum but not found a solution.
I'm wanting to apply the following include in Samba:
Quote
include = /etc/smb.conf/ehsSamba/smb.conf.%m

I have created a snippet in /etc/e-smith/templates-custom/etc/smb.conf/11include:
Quote
{
# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
}
include = /etc/smb.conf/ehsSamba/smb.conf.%m
Path to machine conf:
Quote
/etc/e-smith/templates-custom/etc/smb.conf/ehsSamba/smb.conf.tinprint
I placed a modified conf file in there called smb.conf.tinprint

Then expanded the template & restarted smb service. The machine conf is not applied.
I'm using a fully patched 7.3 installation.
Any ideas on what I'm doing wrong, please?

Thanks,
 
SME Server is a fantastic product - thank you!

Offline Boris

  • *
  • 783
  • +0/-0
Re: Samba includes - smb.conf.%m
« Reply #1 on: March 20, 2008, 06:04:21 PM »
include = /etc/smb.conf/ehsSamba/smb.conf.%m

Is smb.conf in your case folder or file?

...

Offline bloodshoteye

  • *****
  • 232
  • +0/-0
  • Grateful thanks to SME devs
Re: Samba includes - smb.conf.%m
« Reply #2 on: March 21, 2008, 10:45:16 AM »
Hi, boris
Quote
Is smb.conf in your case folder or file?
Sorry, but I'm not sure what you mean - can you provide a little more background, please?
SME Server is a fantastic product - thank you!

Offline Boris

  • *
  • 783
  • +0/-0
Re: Samba includes - smb.conf.%m
« Reply #3 on: March 22, 2008, 08:53:48 PM »
/etc/e-smith/templates-custom/etc/smb.conf/11include

This line above suggested, that you trying to add 11include fragment to /etc/smb.conf file.
BTW for sme 7.3 it should be located in /etc/samba/ folder and template should be placed in /etc/e-smith/templates-custom/etc/samba/smb.conf/11include

Apart from path to smb.conf is wrong for SME 7.3 again, the line below referes to smb.conf as a folder, since the full path is shown /set/smb.conf/ehsSamba/
include = /etc/smb.conf/ehsSamba/smb.conf.%m

Its not clear of what you are trying to do.
...

Offline bloodshoteye

  • *****
  • 232
  • +0/-0
  • Grateful thanks to SME devs
Re: Samba includes - smb.conf.%m
« Reply #4 on: March 27, 2008, 11:05:12 PM »
Boris,
I cannot carry out your suggestion until I recover from an operation, so if I may take a raincheck for a couple of weeks?

Thanks,
SME Server is a fantastic product - thank you!

Offline pfloor

  • *****
  • 889
  • +1/-0
Re: Samba includes - smb.conf.%m
« Reply #5 on: March 28, 2008, 01:58:53 AM »
/etc/e-smith/templates-custom/etc/smb.conf/11include

This line above suggested, that you trying to add 11include fragment to /etc/smb.conf file.
BTW for sme 7.3 it should be located in /etc/samba/ folder and template should be placed in /etc/e-smith/templates-custom/etc/samba/smb.conf/11include

Boris, that is not correct.  The correct paths for /etc/samba/smb.conf templates are:

/etc/e-smith/templates/etc/smb.conf/ <for regular templates
/etc/e-smith/templates-custom/etc/smb.conf/ <for custom templates

See bug http://bugs.contribs.org/show_bug.cgi?id=87

AFAIK, this is the only template directory that is this way and if memory serves me correctly, it is for some backwards compatibility/upgrade issues from older versions because smb.conf was moved and the templates were not.
In life, you must either "Push, Pull or Get out of the way!"

Offline bloodshoteye

  • *****
  • 232
  • +0/-0
  • Grateful thanks to SME devs
Re: Samba includes - smb.conf.%m
« Reply #6 on: March 28, 2008, 10:51:41 AM »
pfloor

please take a look at my original question - is it ok create an arbitrary subdir for an include as I did:
Quote
include = /etc/smb.conf/ehsSamba/smb.conf.%m
After all it is a subdir of smb.conf.

SME Server is a fantastic product - thank you!

Offline pfloor

  • *****
  • 889
  • +1/-0
Re: Samba includes - smb.conf.%m
« Reply #7 on: March 28, 2008, 10:00:07 PM »
pfloor

please take a look at my original question - is it ok create an arbitrary subdir for an include as I did:After all it is a subdir of smb.conf.


Here lies your confusion, /etc/smb.conf doesn't exist and /etc/samba/smb.conf isn't a directory, it is a file.  Also, a subdirectory within templated file doesn't create another directory.  Let me see if I can help you with this.

If you haven't already done so, create a DIRECTORY called  /etc/e-smith/templates-custom/etc/smb.conf

In that directory, create a custom template called 11include2 <--Note the "2" at the end.  This causes this new template to be generated just after the existing 11include template and add your changes in the correct order in smb.conf.

In that template ADD your include directive but CHANGE it to:

include = /etc/samba/smb.conf.%m

If you haven't already done so, now create another DIRECTORY called  /etc/e-smith/templates-custom/etc/samba/smb.conf.tinprint

Then create your template (or template fragments) for smb.conf.tinprint and place them there.

These 2 steps should create the "include" line in /etc/samba/smb.conf and another file called /etc/samba/smb.conf.tinprint.  I *think* this is what you are after.

I suggest you read http://mirror.contribs.org/smeserver/contribs/gordonr/devguide/html/devguide.html#TEMPLATES as it will give you more insight on how the templates work.
« Last Edit: March 29, 2008, 01:10:31 AM by pfloor »
In life, you must either "Push, Pull or Get out of the way!"

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Samba includes - smb.conf.%m
« Reply #8 on: March 28, 2008, 11:40:34 PM »
If you haven't already done so, create a DIRECTORY called  /etc/e-smith/templates-custom/smb.conf

I believe that you mean /etc/e-smith/templates-custom/etc/samba/smb.conf

Quote
In that template ADD your include directive but CHANGE it to:

include = /etc/samba/smb.conf.%m

That looks good.

Quote
If you haven't already done so, now create another DIRECTORY called  /etc/e-smith/templates-custom/samba/smb.conf.tinprint

Here you mean:

/etc/e-smith/templates-custom/etc/samba/smb.conf.tinprint

But if the desired include path really is:

/etc/smb.conf/ehsSamba/smb.conf.%m

then that could be used as well - the template directory would be /etc/e-smith/templates-custom/etc/smb.conf/ehsSamba/smb.conf.tinprint

Quote
These 2 steps should create the "include" line in /etc/samba/smb.conf and another file called /etc/samba/smb.conf.tinprint.

/etc/samba/smb.conf.tinprint will only be created after ardugh runs:

expand-template /etc/samba/smb.conf.tinprint

Alternatively, ardugh could just create /etc/samba/smb.conf.tinprint without templating it. The only problem with this is that file won't be included in a backup/restore.


Offline pfloor

  • *****
  • 889
  • +1/-0
Re: Samba includes - smb.conf.%m
« Reply #9 on: March 29, 2008, 01:03:58 AM »
I believe that you mean /etc/e-smith/templates-custom/etc/samba/smb.conf

Sorry, a typo but I did mean /etc/e-smith/templates-custom/etc/smb.conf (fixed above) but as I read the metadata files it looks like either path will work.  Thus lies the confusion about smb.conf.

The file lies here: /etc/samba/smb.conf
The template directory is here: /etc/e-smith/templates/etc/smb.conf
And custom templates should go here?: /etc/e-smith/templates-custom/etc/samba/smb.conf
I've always put smb custom templates here:  /etc/e-smith/templates-custom/etc/smb.conf

So as I understand it, either location will work.

Quote
Here you mean:

/etc/e-smith/templates-custom/etc/samba/smb.conf.tinprint

Yes, that is correct (typo AGAIN, I will edit it).

Quote
But if the desired include path really is:

/etc/smb.conf/ehsSamba/smb.conf.%m

then that could be used as well - the template directory would be /etc/e-smith/templates-custom/etc/smb.conf/ehsSamba/smb.conf.tinprint

You could do that but it adds an additional directory where samba related files would be kept (/etc/smb.conf/...).  I think the location of the templates vs the location of smb.conf is what threw ardugh off, and thus all the different approaches shown here.

ardugh, where exactly do you want smb.conf.tinprint?

Your original post has it here /etc/smb.conf/ehsSamba/smb.conf.tinprint but /etc/smb.conf/ does not exist so you would be adding an additional location for samba related config files.

/etc/samba/ehsSamba/smb.conf.tinprint would be better but adds an additional subdirectory.

My initial instructions put it with the rest of the samba config files at /etc/samba/

Where do you want it to be?
« Last Edit: March 29, 2008, 01:14:18 AM by pfloor »
In life, you must either "Push, Pull or Get out of the way!"

Offline bloodshoteye

  • *****
  • 232
  • +0/-0
  • Grateful thanks to SME devs
Re: Samba includes - smb.conf.%m
« Reply #10 on: March 29, 2008, 11:39:14 PM »
pfloor
Quote
I think the location of the templates vs the location of smb.conf is what threw ardugh off, and thus all the different approaches shown here.
You're correct - I'm hoping this will be resolved in v8, but if not perhaps a detailed howto would be nice.

Quote
where exactly do you want smb.conf.tinprint?
Anywhere, I guess, but on reflection in the same area as other custom smb templates would be best - Charlie Brady's comment re backups is relevant here.
Because I will need quite a few machine templates, a dedicated sub directory would be best, which is why I thought of:
/etc/e-smith/templates-custom/etc/smb.conf/ehsSamba/smb.conf.%m
- the directory ehsSamba would thus contain all the machine confs.

According to you & Charlie Brady, my mistake is an incorrect original include fragment path, which should be:
Quote
include = /etc/samba/smb.conf.%m
But would that find the "ehsSamba" machine confs?
SME Server is a fantastic product - thank you!

Offline pfloor

  • *****
  • 889
  • +1/-0
Re: Samba includes - smb.conf.%m
« Reply #11 on: March 30, 2008, 12:36:54 AM »
pfloorYou're correct - I'm hoping this will be resolved in v8, but if not perhaps a detailed howto would be nice.
I don't think it will change.  The location of smb.conf was moved from /etc/ to /etc/samba/ and the current template system takes that into account for backward compatibility reasons.

Quote
Anywhere, I guess, but on reflection in the same area as other custom smb templates would be best - Charlie Brady's comment re backups is relevant here.
Because I will need quite a few machine templates, a dedicated sub directory would be best, which is why I thought of:
/etc/e-smith/templates-custom/etc/smb.conf/ehsSamba/smb.conf.%m
- the directory ehsSamba would thus contain all the machine confs.

In that case, you need the following:

-create a directory called  /etc/e-smith/templates-custom/etc/smb.conf
-copy the 11include template fragment to the new directory and change it as follows:

Code: [Select]
{
# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
}
include = /etc/samba/ehsSamba/smb.conf.%m

-Create a directory called /etc/samba/ehsSamba/
-Create a custom template directory called /etc/e-smith/templates-custom/etc/samba/ehsSamba/smb.conf.tinprint/
-In that directory put your template (or template fragments).

expand-template /etc/smb.conf
expand-template /etc/samba/ehsSamba/smb.conf.tinprint

Or if you have many machines you can use:
expand-template /etc/samba/ehsSamba/*
And it will expand all the conf files under ehsSamba all at once.

Now your machine conf files is under /etc/samba/ehsSamba/ and if you add more machines they can go there as well by adding additional custom template directories like:
/etc/e-smith/templates-custom/etc/samba/ehsSamba/smb.conf.machineX/ and placing the template (or template fragments) for that machine there.

Now everything will get backed up and easily restored/upgraded.

Hope that helps.

-Paul
« Last Edit: March 30, 2008, 12:43:29 AM by pfloor »
In life, you must either "Push, Pull or Get out of the way!"

Offline bloodshoteye

  • *****
  • 232
  • +0/-0
  • Grateful thanks to SME devs
Re: Samba includes - smb.conf.%m
« Reply #12 on: March 30, 2008, 01:59:48 PM »
Paul, I conclude:
Quote
Now your machine conf files is under /etc/samba/ehsSamba/ and if you add more machines they can go there as well by adding additional custom template directories like:
/etc/e-smith/templates-custom/etc/samba/ehsSamba/smb.conf.machineX/ and placing the template (or template fragments) for that machine there.
If I understand you correctly, in this particular case I need a hierarchy of directories. To have a semblance of order, I have "ehsSamba" collectively holding individual directories named after machines and in each of these "machine directories" there must be a "11include" conf file particular to that machine.

I doubt I would have figured this out by myself.
Thanks for all the input from those who have helped. I will put this into practice as soon as my convalescence period is over and report back to the list.
SME Server is a fantastic product - thank you!

Offline bloodshoteye

  • *****
  • 232
  • +0/-0
  • Grateful thanks to SME devs
Re: Samba includes - smb.conf.%m
« Reply #13 on: May 30, 2008, 07:55:30 PM »
Hi all,

Ok, I tried this (even rebooted once):
1) put the following into /etc/e-smith/templates-custom/etc/smb.conf/11include
Quote
include = /etc/smb.conf/ehsSamba/smb.conf.%m

2) Created a directory called /etc/samba/ehsSamba/
(this is where expand-template will place custom confs.)

3) Created a custom template directory called /etc/e-smith/templates-custom/etc/samba/ehsSamba/smb.conf.tinprint/smb.conf
(this is where I placed customized machine confs.)

3) expand-template /etc/smb.conf

4) expand-template /etc/samba/ehsSamba/*
Fails with following error:
Quote
# expand-template /etc/samba/ehsSamba/*
ERROR: No templates were found for /etc/samba/ehsSamba/*.
 at /sbin/e-smith/expand-template line 45
(I also tried specifically naming a conf file as in: expand-template /etc/samba/ehsSamba/smb.conf.tinprint
and got the same result.

I tried a previous suggestion and created:
/etc/e-smith/templates-custom/etc/smb.conf/ehsSamba/smb.conf.tinprint/smb.conf
I get the same error when running expand-template as above.

Any ideas, pfloor and CharlieBrady, if you will?
SME Server is a fantastic product - thank you!

Offline pfloor

  • *****
  • 889
  • +1/-0
Re: Samba includes - smb.conf.%m
« Reply #14 on: May 30, 2008, 08:57:43 PM »
2) Created a directory called /etc/samba/ehsSamba/

That looks OK

Quote
3) Created a custom template directory called /etc/e-smith/templates-custom/etc/samba/ehsSamba/smb.conf.tinprint/smb.conf
(this is where I placed customized machine confs.)

It looks like you have an extra directory (/smb.conf).  You need a template (or template fragments) under /smb.conf.tinprint/ not another directory.  The template fragments will then create the file located at /etc/samba/ehsSamba/ and that file will be called smb.conf.tinprint.

The way you have it now it will create a file located at /etc/samba/ehsSamba/smb.conf.tinprint/ and the file will be called smb.conf

Does that make sense?
« Last Edit: May 30, 2008, 09:01:00 PM by pfloor »
In life, you must either "Push, Pull or Get out of the way!"