editing smb.conf (INI files)

Discussion in 'Perl Misc' started by Tomasz Chmielewski, Jun 30, 2008.

  1. 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?


    --
    Tomasz Chmielewski
    http://wpkg.org
    Tomasz Chmielewski, Jun 30, 2008
    #1
    1. Advertising

  2. Joe Smith schrieb:
    > Tomasz Chmielewski wrote:
    >> What would you use to parse smb.conf or INI-files in a somehow
    >> automated/scripted manner?

    >
    > 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!


    --
    Tomasz Chmielewski
    http://wpkg.org
    Tomasz Chmielewski, Jun 30, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Granger Godbold
    Replies:
    3
    Views:
    5,003
    Granger Godbold
    Jul 3, 2004
  2. john bailo

    using SMB as filesystem mounts

    john bailo, Sep 10, 2003, in forum: Java
    Replies:
    3
    Views:
    396
    Davide Consonni
    Sep 11, 2003
  3. Atila Olah

    Python and SMB, again...

    Atila Olah, Sep 12, 2005, in forum: Python
    Replies:
    4
    Views:
    3,146
    Atila Olah
    Sep 14, 2005
  4. Ronnie Kwok

    Connecting to SMB share in python

    Ronnie Kwok, Sep 25, 2008, in forum: Python
    Replies:
    4
    Views:
    5,375
    Tim Golden
    Sep 25, 2008
  5. chip9munk

    editing conf file

    chip9munk, Nov 16, 2012, in forum: Python
    Replies:
    10
    Views:
    298
Loading...

Share This Page