Add to Favourites Add to Favourites    Print this Article Print this Article

Adding a value to the directadmin.conf

The directadmin.conf lives here:


Lets use an example where we want to set        
to a value of .

The end goal would be to see this in the directadmin.conf:


  1. To add a value to this file, there are a few ways to do to it.
    • Either edit the file manually to either edit a variable that's already set.
    • Or, if you know the value does not exist at all, you can use the echo command:

      echo "name=value" >> /usr/local/directadmin/conf/directadmin.conf

      to add the value to the bottom.  Only use this if you know the value is not currently set.
    • The last method would be if the value currently exists, where you could use a perl regex (Assuming your name/value have basic characters, else this might not work):

      perl -pi -e 's/^name=.*$/name=value/' /usr/local/directadmin/conf/directadmin.conf

  2. Once the variable is set, the next step is to ensure it's set.
    For that, type:

    cd /usr/local/directadmin
    ./directadmin c | grep ^name=

    to ensure you see the value specified.

    If you do not see the value set, then make sure the end of the directadmin.conf has a trailing newline character.
    What this means is that there should be a blank line at the bottom of the file, because when reading a config file, DA defines a "line" has ending with a newline character (the 'enter' key).
  3. Last step is to restart DA to load in your setting:

    cd /usr/local/directadmin
    echo "action=directadmin&value=restart" >> data/task.queue; ./dataskq d2000

Was this answer helpful?

Also Read