How to modify Drupal configuration programmatically?
Most of these configuration settings tend to be controlled by a variable, so Drupal uses variable_get() and variable_set() to retrieve and modify these values.

To find out the variable name and value you can have a look at the source page.  For example:

&lt;label for="edit-user-register"&gt;Who can register accounts? &lt;/label&gt;
&lt;div id="edit-user-register" class="form-radios"&gt;
  &lt;input type="radio" id="edit-user-register-0" name="user_register" value="0" class="form-radio"&gt;  
  &lt;label class="option" for="edit-user-register-0"&gt;Administrators only &lt;/label&gt;

  &lt;input type="radio" id="edit-user-register-1" name="user_register" value="1" class="form-radio"&gt;
  &lt;label class="option" for="edit-user-register-1"&gt;Visitors &lt;/label&gt;

  &lt;input type="radio" id="edit-user-register-2" name="user_register" value="2" checked="checked" class="form-radio"&gt;
  &lt;label class="option" for="edit-user-register-2"&gt;Visitors, but administrator approval is required &lt;/label&gt;
&lt;/div&gt;


Here you can see that in order to change the "Who can register accounts?" option, you need to change the value of the user_register variable. You can set it to 1 for visitors, so putting this code in your module will do the trick:

variable_set('user_register', 1);


Of course, this is if you're too lazy to open the source code :) .  The other way is to find out which callback generates this form, and inspect user.module:

function user_menu() {
  //snip...
  $items['admin/config/people/accounts'] = array(
    'title' =&gt; 'Account settings',
    'description' =&gt; 'Configure default behavior of users, including registration requirements, e-mails, fields, and user pictures.',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('user_admin_settings'),
    'access arguments' =&gt; array('administer users'),
    'file' =&gt; 'user.admin.inc',
    'weight' =&gt; -10,
  );


Then find the callback function user_admin_settings() in user.admin.inc:

$form['registration_cancellation']['user_register'] = array(
  '#type' =&gt; 'radios', 
  '#title' =&gt; t('Who can register accounts?'), 
  '#default_value' =&gt; variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL), 
  '#options' =&gt; array(
    USER_REGISTER_ADMINISTRATORS_ONLY =&gt; t('Administrators only'), 
    USER_REGISTER_VISITORS =&gt; t('Visitors'), 
    USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL =&gt; t('Visitors, but administrator approval is required'),
  ),
);


So there you have your variable and in fact there's some constant to set up the values: USER_REGISTER_VISITORS.