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

How can I create a "User" using the command line?

Scheduled Pinned Locked Moved webGUI
8 Posts 3 Posters 4.8k 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.
  • A
    ahmedibrahim
    last edited by Feb 24, 2019, 10:31 PM

    I teach courses where I can have 80-100 students. I want to give each one of them VPN access while maintaining a record of who logs in to the VPN. Thus, I need a unique username/password for each user. I'm interested in writing a script that can generate, say, 100 users.

    P.S: I know someone will say why don't you want to use the Web GUI. The answer is: I will add 100 users then remove them then add another 100 users then remove them and so on. The GUI is not the right option for me.

    1 Reply Last reply Reply Quote 0
    • J
      jimp Rebel Alliance Developer Netgate
      last edited by Feb 25, 2019, 4:07 PM

      Use RADIUS for that, not the pfSense user manager.

      And not necessarily the pfSense FreeRADIUS package, but a separate RADIUS server. You could load your users in easily in most cases with RADIUS. OpenLDAP may also work for auth but tends to be more complicated to setup.

      Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

      Need help fast? Netgate Global Support!

      Do not Chat/PM for help!

      A 1 Reply Last reply Feb 25, 2019, 4:15 PM Reply Quote 0
      • A
        ahmedibrahim @jimp
        last edited by Feb 25, 2019, 4:15 PM

        @jimp Thanks for the advice. I don't know how to implement the solution you proposed. If you have a link to a good tutorial I'll be thankful.

        1 Reply Last reply Reply Quote 0
        • N
          NogBadTheBad
          last edited by Feb 25, 2019, 4:43 PM

          Are you using IPsec or OpenVPN?

          Andy

          1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

          A 1 Reply Last reply Feb 25, 2019, 4:50 PM Reply Quote 0
          • A
            ahmedibrahim @NogBadTheBad
            last edited by Feb 25, 2019, 4:50 PM

            @nogbadthebad OpenVPN

            N 1 Reply Last reply Feb 25, 2019, 4:50 PM Reply Quote 0
            • N
              NogBadTheBad @ahmedibrahim
              last edited by Feb 25, 2019, 4:50 PM

              @ahmedibrahim

              https://docs.netgate.com/pfsense/en/latest/vpn/openvpn/authenticating-openvpn-users-with-freeradius.html

              Andy

              1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

              A 1 Reply Last reply Feb 25, 2019, 4:52 PM Reply Quote 0
              • A
                ahmedibrahim @NogBadTheBad
                last edited by Feb 25, 2019, 4:52 PM

                @nogbadthebad It seems that I will still have to enter the username/password for every user through the GUI. Do you have a command that you used to create users through the cli after setting up the RADIUS as mentioned in the link you sent?

                1 Reply Last reply Reply Quote 0
                • N
                  NogBadTheBad
                  last edited by NogBadTheBad Feb 25, 2019, 4:58 PM Feb 25, 2019, 4:54 PM

                  I'd be tempted to create student001 to student100.

                  You may be able to get clever and create student001 via the GUI, do a backup and take a text editor to the XML file to create the other 99 accounts.

                  			<config>
                  				<sortable></sortable>
                  				<varusersusername>student1</varusersusername>
                  				<varuserspassword>student1</varuserspassword>
                  				<varuserspasswordencryption>Cleartext-Password</varuserspasswordencryption>
                  				<varusersmotpenable></varusersmotpenable>
                  				<varusersauthmethod>motp</varusersauthmethod>
                  				<varusersmotpinitsecret></varusersmotpinitsecret>
                  				<varusersmotppin></varusersmotppin>
                  				<varusersmotpoffset></varusersmotpoffset>
                  				<qrcodetext></qrcodetext>
                  				<varuserswisprredirectionurl></varuserswisprredirectionurl>
                  				<varuserssimultaneousconnect></varuserssimultaneousconnect>
                  				<description></description>
                  				<varusersframedipaddress></varusersframedipaddress>
                  				<varusersframedipnetmask></varusersframedipnetmask>
                  				<varusersframedroute></varusersframedroute>
                  				<varusersvlanid></varusersvlanid>
                  				<varusersexpiration></varusersexpiration>
                  				<varuserssessiontimeout></varuserssessiontimeout>
                  				<varuserslogintime></varuserslogintime>
                  				<varusersamountoftime></varusersamountoftime>
                  				<varuserspointoftime>Daily</varuserspointoftime>
                  				<varusersmaxtotaloctets></varusersmaxtotaloctets>
                  				<varusersmaxtotaloctetstimerange>daily</varusersmaxtotaloctetstimerange>
                  				<varusersmaxbandwidthdown></varusersmaxbandwidthdown>
                  				<varusersmaxbandwidthup></varusersmaxbandwidthup>
                  				<varusersacctinteriminterval></varusersacctinteriminterval>
                  				<varuserstopadditionaloptions></varuserstopadditionaloptions>
                  				<varuserscheckitemsadditionaloptions></varuserscheckitemsadditionaloptions>
                  				<varusersreplyitemsadditionaloptions>Class := &quot;admins&quot;</varusersreplyitemsadditionaloptions>
                  			</config>```

                  Andy

                  1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

                  1 Reply Last reply Reply Quote 0
                  8 out of 8
                  • First post
                    8/8
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                    This community forum collects and processes your personal information.
                    consent.not_received