Community discussions

MikroTik App
Centauri
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Sun Jun 06, 2010 8:51 pm

Set Admin Password via Config File (Flashfig)

Mon Jun 15, 2015 10:14 am

Is it possible to set the Admin password via a configuration script ?
The password at within a normal backup file but not an exportet config file. I had hoped for an hashed password ore something like that.

The problem is i need to configure 850 individual hAP Lite boxes with an custom config file so i have mad a script that generates each config file so that it can be loaded with Flashfig because each has different IP Addresses and WiFi Settings so cant use a normal backup file.
Everything works but it has a blank Admin password afterwords.

I have tryed to inset the command
/password new-password=12345678 new-password=12345678 old-password=
In my config file but it seems to require some password as the old password even if its a blank password or i at least have to press enter once again.
所以dos派似乎工作把我这条线n a config file.

Anyone have en ide how to set the password via a configuration file, because would be a lot of extra work for me logging in en each of the 850 boxes and manual setting the password.
Top
User avatar
tomaskir
Trainer
Trainer
Posts: 1161
Joined: Sat Sep 24, 2011 2:32 pm
Location:Slovakia

Re: Set Admin Password via Config File (Flashfig)

Mon Jun 15, 2015 12:50 pm

Code:Select all
/user set [/user find name="admin"] password=123456
Top
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Set Admin Password via Config File (Flashfig)

Mon Jun 15, 2015 12:53 pm

If the old password is an empty string, you can just use quotes to form a quoted empty string, i.e.
Code:Select all
/password new-password=12345678 old-password=""
Top
Centauri
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Sun Jun 06, 2010 8:51 pm

Re: Set Admin Password via Config File (Flashfig)

Wed Jun 17, 2015 12:24 pm

Thanks tomaskir that solved my problem.
Top
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 25879
Joined: Fri May 28, 2004 11:04 am
Location:Riga, Latvia

Re: Set Admin Password via Config File (Flashfig)

Wed Jun 17, 2015 12:54 pm

better just make a new user that is not admin, and then delete admin. making a new user is done with a single command, no confirmation. using a non-admin user is more secure, since one also has to guess the username
Top
jarda
Forum Guru
Forum Guru
Posts: 7752
Joined: Mon Oct 22, 2012 4:46 pm

Wed Jun 17, 2015 3:40 pm

I am always doing that and I suggest to delete admin account immediately after other user creation.
Top
Centauri
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Sun Jun 06, 2010 8:51 pm

Re: Set Admin Password via Config File (Flashfig)

Wed Jun 17, 2015 4:27 pm

In my setup its not necessary.
Management is blocked from the LAN Site.
And on the WAN site ist only allowed from an specific Subnet on an separate VLAN.
But else its right its best to make a new admin account wit another username.
Top
normalcy
newbie
Posts: 42
Joined: Tue Jan 03, 2012 6:35 am
Location:Brisbane, Australia

Set Admin Password via Config File (Flashfig)

Thu Jul 23, 2015 1:01 pm

Out of interest how did you generate all the individual script files?

I'm facing something similar with a lot of haps as well. Looking into milliscript and flashfig and all the rest but I can see that you will still need create a per device script to load (for identity etc).
Top
Centauri
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Sun Jun 06, 2010 8:51 pm

Re: Set Admin Password via Config File (Flashfig)

Thu Jul 23, 2015 3:43 pm

I have en MySQL database with all the Individual settings for each apartment, with the WAN IP, SSID and SSID Password.
Then i have a VB script reading chose information and and and passes them in to a template config and replaces {SSID} and {SSIDKEY} alt other information with the values from the Database and saves each config in a separate config..

Part of the Template Config
/system identity
set name={Apartment}
/interface wireless
set [ find default-name=wlan1 ] band=2ghz-b/g/n channel-width=20/40mhz-Ce \
country=denmark disabled=no distance=indoors frequency=auto \
frequency-mode=regulatory-domain l2mtu=1600 mode=ap-bridge rx-chains=0,1 \
ssid={SSID} tx-chains=0,1 wireless-protocol=802.11

/interface wireless security-profiles
set [ find default=yes ] authentication-types=wpa2-psk eap-methods="" \
group-ciphers=tkip mode=dynamic-keys supplicant-identity=MikroTik \
unicast-ciphers = tkip wpa2-pre-shared-key = {SSIDKEY}

The reason why i have all in a database in because i have made a Web System from where its possible to change the SSID Passwords and some other settings.
Top

Who is online

Users browsing this forum:bpwl,Renfrew,Semrush [Bot]and 25 guests