editing smb.conf (INI files)

T

Tomasz Chmielewski

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:

[homes]
valid users = user1, user2

[data]
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?
 
T

Tomasz Chmielewski

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

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

Thanks a lot!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top