editing smb.conf (INI files)

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Anyone using Samba here? Or knows how an INI-file structure looks like?

What would you use to parse smb.conf or INI-files in a somehow
automated/scripted manner?

Let's say this is a part of smb.conf:

  valid users = user1, user2

  valid users = user1, user2

And we want to add "user3" to "valid users" in [homes] in a script.

I've searched a bit and found some INI-file parsers, but they are
basically for extracting values, not editing/changing/adding them.

Are there any perl modules which help editing smb.conf or INI-files in
an automated/scripted way?

Tomasz Chmielewski

Re: editing smb.conf (INI files)

Tomasz Chmielewski wrote:
Quoted text here. Click to load it

Config::Tiny - Read/Write .ini style files with as little code as possible

# Changing data
$Config-> = { this => 'that' }; # Add a section
$Config->-> = 'Not Bar!';     # Change a value
delete $Config->;                        # Delete a value or section
# Save a config
$Config->write( 'file.conf' );

Site Timeline