• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Create users - import file

Scheduled Pinned Locked Moved Captive Portal
8 Posts 7 Posters 8.6k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    trcorreia
    last edited by Dec 6, 2008, 7:08 PM

    Hi

    I installed the pfsense in school and use the Cp for users to log into, but I'm having a problem. I have 500 students to enroll  :o . I wonder if there is the possibility of importing a file with the username, password and name to be simpler.

    thanks

    1 Reply Last reply Reply Quote 0
    • B
      blak111
      last edited by Dec 7, 2008, 8:29 AM

      If you already have all of those accounts entered into another system like active directory, you could just use the radius authentication option and the radius server built into windows server so you don't have to make another set of accounts to manage.

      1 Reply Last reply Reply Quote 0
      • T
        thecrazyspy
        last edited by Dec 9, 2008, 8:14 AM

        I also seeks I do that but just with a list excel for some users.

        1 Reply Last reply Reply Quote 0
        • G
          GruensFroeschli
          last edited by Dec 9, 2008, 8:36 AM

          Create a test user and download the config.xml.
          Now you should have an example of how a user-entry looks like.

          We do what we must, because we can.

          Asking questions the smart way: http://www.catb.org/esr/faqs/smart-questions.html

          1 Reply Last reply Reply Quote 0
          • R
            rav
            last edited by Mar 4, 2009, 1:17 AM

            @GruensFroeschli:

            Create a test user and download the config.xml.
            Now you should have an example of how a user-entry looks like.

            I habe de same problem and where can i dowload the fie config.xml
            thank you

            1 Reply Last reply Reply Quote 0
            • G
              GruensFroeschli
              last edited by Mar 4, 2009, 9:56 AM

              Diagnostic –> Backup/Restore

              We do what we must, because we can.

              Asking questions the smart way: http://www.catb.org/esr/faqs/smart-questions.html

              1 Reply Last reply Reply Quote 0
              • E
                evewes
                last edited by Mar 23, 2009, 4:57 AM

                @rav:

                @GruensFroeschli:

                Create a test user and download the config.xml.
                Now you should have an example of how a user-entry looks like.

                I habe de same problem and where can i dowload the fie config.xml
                thank you

                Did it work for you? I shall test download the config and upload a new one completed with 500 user and password.

                1 Reply Last reply Reply Quote 0
                • O
                  OldNick
                  last edited by Mar 26, 2009, 10:59 AM Mar 26, 2009, 10:54 AM

                  If you want to import into freeradius from a file you could try something along these lines.

                  `$file_handle = fopen("users.csv", "r");
                  while (!feof($file_handle) ) {
                          $line_of_text = fgets($file_handle);
                          $sStream .= $line_of_text;
                  }

                  fclose($file_handle);
                  $arUsers = explode("\n", $sStream);
                  $sUserCount = count($arUsers)-1 ;

                  for ($i = 0;$i< $sUserCount; $i++){
                       $sTmp = $arUsers[$i];
                       $arAcct = explode(",",$sTmp);
                       if (  AddXML(false,$arAcct) ) AddDbUser ($arAcct);
                       if ( $i > $sUserCount ) break;
                  }

                  function AddDBUser($fDebug,$arAcct){

                  include "opendb.php";
                       $SQL = "INSERT INTO radcheck (UserName, Attribute, op, Value) VALUES ('$arAcct[0]', 'User-Password', ':=', '$arrAcct[0]');";
                       $QResult = mysql_query($SQL);
                       include "closedb.php";
                  }`

                  users.csv is simply a list of username password pairs eg fred, apples\n tom, oranges

                  opendb.php and closedb.php are included pages to handle the connection to the radius db

                  Obviously thats ver simple only using the usename passwrod pair, it would be no hassle at all to extend it to add additional radius attributes

                  Its a bit rough and ready and probably has some errors as I just jotted it down from memory of past stuff I've done. I do hope it helps some one

                  Regards

                  Nick

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                    [[user:consent.lead]]
                    [[user:consent.not_received]]