Koozali.org: home of the SME Server

Samba includes - smb.conf.%m

Offline bloodshoteye

  • *****
  • 232
  • +0/-0
  • Grateful thanks to SME devs
Re: Samba includes - smb.conf.%m
« Reply #15 on: May 31, 2008, 02:19:45 PM »
pfloor,

Quote
It looks like you have an extra directory (/smb.conf).
Actually the smb.conf referred to here: /etc/e-smith/templates-custom/etc/samba/ehsSamba/smb.conf.tinprint/smb.conf
is a file. The file contains the edited smb.conf for thar particular machine, tinprint.
Should I call the file something other than smb.conf?
SME Server is a fantastic product - thank you!

Offline pfloor

  • *****
  • 889
  • +1/-0
Re: Samba includes - smb.conf.%m
« Reply #16 on: May 31, 2008, 06:45:34 PM »
I must apologize, I missed one "small" step.  You must create an empty file of the one you are trying to create through the template system.  IOW:

touch /etc/samba/ehsSamba/smb.conf.tinprint

pfloor,
Actually the smb.conf referred to here: /etc/e-smith/templates-custom/etc/samba/ehsSamba/smb.conf.tinprint/smb.conf
is a file. The file contains the edited smb.conf for thar particular machine, tinprint.
Should I call the file something other than smb.conf?

It doesn't matter but you may want to call it something else to eliminate confusion and really utilize the power of the template system.  Template fragments are generally called 10something, 20something, etc and expanded in order.  If you had 10something and 20something-else and wanted to add something in the middle then you would create 15additional-something.

So with that said, I would do it like this and here are ALL the steps all written out in CL:

(NOTE: I have changed the name of your custom template fragment to 10MachineConf).

Create your custom template directory smb.conf and copy 11include:

Code: [Select]
mkdir -p /etc/e-smith/templates-custom/etc/smb.conf
cp /etc/e-smith/templates/etc/smb.conf/11include /etc/e-smith/templates-custom/etc/smb.conf

Now edit /etc/e-smith/templates-custom/etc/smb.conf/11include to suite your needs.

Create your machine's conf directory and (empty) file.

Code: [Select]
mkdir -p /etc/samba/ehsSamba
touch /etc/samba/ehsSamba/smb.conf.tinprint
Note the new "touch" command that I missed in my initial instructions.

Now create the custom template directory and (empty) template fragment.

Code: [Select]
mkdir -p /etc/e-smith/templates-custom/etc/samba/ehsSamba/smb.conf.tinprint
touch /etc/e-smith/templates-custom/etc/samba/ehsSamba/smb.conf.tinprint/10MachineConf

Now edit /etc/e-smith/templates-custom/etc/samba/ehsSamba/smb.conf.tinprint/10MachineConf to suite your needs.

Code: [Select]
expand-template /etc/smb.conf
expand-template /etc/samba/ehsSamba/smb.conf.tinprint

Or if you have multiple machine conf files:

Code: [Select]
expand-template /etc/samba/ehsSamba/*
And then of course you must restart samba for your changes to take effect.

Next lesson: How to utilize the config db with templates so your config files are generated via db settings...Oh wait, that will take way too much time :-)

If you have a test test machine (VMWare is great for this) you should read the developer's manual and play around.  Here is the section on templates: http://wiki.contribs.org/SME_Server:Documentation:Developers_Manual#Configuration_file_templates but I would suggest you start from the beginning.  You will probably need to read it at least 3 times before you begin to get your head around it.  I have read all of it 5 times and still don't understand 50% of it :-)
« Last Edit: May 31, 2008, 06:49:44 PM 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 #17 on: June 01, 2008, 05:15:20 PM »
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.

Paul, I think you are trying to make this more complicated than it needs to be. I don't see anything here which sugggests that the individual fragments to be included need to be templated. As long as smb.conf contains the "include ....%m" line which has been requested, then smb.conf.tinprint and smb.conf.* for other workstations can each be individually created containing whatever is wanted.

We don't appear to have been told what problem is trying to be solved, or what the content of the individual smb.conf.%m files will be, so it's hard to help further.

Offline bloodshoteye

  • *****
  • 232
  • +0/-0
  • Grateful thanks to SME devs
Re: Samba includes - smb.conf.%m
« Reply #18 on: June 02, 2008, 08:53:31 AM »
pfloor,

Thanks, I will carry out your suggestion later this afternoon when the network is quieter. Thanks for spending time on this - I appreciate it.

######
EDITS - moved (by me) to a reply to this thread.
######

CharlieBrady,

Perhaps my original post was not clear enough. I need to apply samba machine configurations to pupils who are logging on to an exam session, in our case, starting tomorrow June 3... They will have adjusted environments during the session, and I've always used samba machine confs in the past. Seating is random during exams, thus the need for  machine confs. These must be removed after the session/s, obviously.
« Last Edit: June 02, 2008, 03:46:54 PM by ardugh »
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 #19 on: June 02, 2008, 03:45:24 PM »
Hi

Reporting back on progress to date:

A test shows the empty file in /etc/samba/ehsSamba/smb.conf.tinprint now contains the contents of /etc/e-smith/templates-custom/etc/samba/ehsSamba/smb.conf.tinprint/10MachineConf - just as you have detailed.

1) Early testing shows the need to comment out lines in the Login Scrip Manager contrib, which is used to map a number of drives using the #ifg groupname1, groupname2 syntax. These are not offered via the edited machine conf, but are still available to exam candidates unless commented out.

2) For some reason I have to do - 67 times  :sad: :
expand-template /etc/smb.conf
expand-template /etc/samba/ehsSamba/smb.conf.<machine_name>
for each custom template - appending a star doesn't do anything??
« Last Edit: June 02, 2008, 04:28:37 PM by ardugh »
SME Server is a fantastic product - thank you!

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Samba includes - smb.conf.%m
« Reply #20 on: June 02, 2008, 10:21:30 PM »
2) For some reason I have to do - 67 times  :sad: :
expand-template /etc/smb.conf
expand-template /etc/samba/ehsSamba/smb.conf.<machine_name>
for each custom template

You wouldn't need to do that if you didn't template the 67 individual config files, but just edited each directly, as required.

Quote
- appending a star doesn't do anything??

No, expand-template only expands a single file. Using * creates a list of files, and only the first one is processed.

Offline bloodshoteye

  • *****
  • 232
  • +0/-0
  • Grateful thanks to SME devs
Re: Samba includes - smb.conf.%m
« Reply #21 on: June 03, 2008, 09:12:33 AM »
CharlieBrady

Quote
You wouldn't need to do that if you didn't template the 67 individual config files, but just edited each directly, as required.
My previous post was a bit misleading - i didn't have to do expand-template /etc/smb.conf multiple times, just expand-template /etc/samba/ehsSamba/smb.conf.<machine_name>
As you said, expand-template only expands a single file.

Quote
You wouldn't need to do that if you didn't template the 67 individual config files, but just edited each directly, as required
I don't quite get this - where would I edit each directly as required?
« Last Edit: June 03, 2008, 03:22:31 PM by ardugh »
SME Server is a fantastic product - thank you!

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Samba includes - smb.conf.%m
« Reply #22 on: June 03, 2008, 03:12:57 PM »
I don't quite get this - where would I edit each directly as required?

You would edit each /etc/samba/ehsSamba/smb.conf.<machine_name>. If you are not configuring any configuration or accounts database information in those files, then they don't need to be templated.

Offline bloodshoteye

  • *****
  • 232
  • +0/-0
  • Grateful thanks to SME devs
Re: Samba includes - smb.conf.%m
« Reply #23 on: June 03, 2008, 03:41:25 PM »
Quote
You would edit each /etc/samba/ehsSamba/smb.conf.<machine_name>. If you are not configuring any configuration or accounts database information in those files, then they don't need to be templated.

The idea is to provide them with access only to ~home/
All other samba shares must be denied (to them, while staff must work as usual). I know the machine names they will use. I move existing homes to a holding area and replace them with a specially prepared ~/home containing exam questions. They get new profile directories too, in case enterprising pupils have hidden work somewhere in the myriads of directories m$ provides in profiles.

They all get a standard cut-down machine fragment, which I'm not sure worked today. I also remmed out drive mappings in the Login Script Manager contrib. Their "My Computer" only showed the so called "exam" home drive, but one or two found they could still map a drive to samba shares they have rights to.
I then used standard Linux permissions and denied Group & Others access to these shares - that kept them out.

In the end, the whole process seems needlessly complicated.
I strongly wish these particular teachers would investigate moodle.
But that won't help in grade 12 - their final is very strictly controlled and moodle will not be an option, as far as I can see.
SME Server is a fantastic product - thank you!