How to change (AdGuard) plugin admin password?

dabrahams

Dabbler
Joined
Jan 1, 2022
Messages
12
I just installed the AdGuard plugin, whose management interface has a default username and password of "admin." I'd like to change that, but I don't see a way. Can anyone offer a hint?

Thanks!
 

Maximos

Cadet
Joined
Feb 10, 2022
Messages
2
Got the same problem, there seems to be no documentation for this. All the documentation I can find is for Ubuntu or Fedora. However Truenas' plugin runs on FreeBSD, which is not the same.

I've tried going into the shell install htpasswd with:
pkg install *-htpasswd
After that I'm supposed to recreate a hash. However I cant get this to work.
Tried running:
htpasswd.py -B -n -b <USERNAME> <PASSWORD>
But it returns:
Error: No such option: -B

I think I have to use htpasswd.py -c -B <USERNAME> <PASSWORD>

But then I have to specify a filename (adguardhome.yaml)

I tried with: locate adguardhome.yaml; No results
Also tried with: find / -name adguardhome.yaml; Still nothing though.

Is there a different file I have to edit? Or do I have to make this file in a specific location?

If someone could point me in the right direction it would be greatly appreciated.

Cheers!
 

herci85

Cadet
Joined
Feb 19, 2022
Messages
1
Hi,

I was having the same problem but now I think I have found the solution.
You can find the config file at
/usr/local/bin/AdGuardHome.yaml
All you need to do is to replace the password hash with your Bcrypt encrypted hash.
You can find online generators using google.
Once you have replaced the hash with your own, restart the jail and login with the new pass.

Hope it helps.
 

Maximos

Cadet
Joined
Feb 10, 2022
Messages
2
Hey Herci, thanks for pointing that out. I was looking for that config file...
Got it working because of your help. Cheers!
 

Oatbag

Cadet
Joined
Nov 16, 2022
Messages
5
For other lost souls like me who didn't get this working.

For TrueNAS Core (BSD)

Open shell in the Adguard jail

Shutdown adguardhome (edits to AdGuardHome.yaml wont stick if it's running!)
service adguardhome stop

Generate new password - Do this on another machine, OR on the Truenas HOST shell, not the Jail.
htpasswd -B -n -b <USERNAME> <PASSWORD>

ex. htpasswd -B -n -b admin password123

Result is:
admin:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Copy just the xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx part

I'm a luddite so I use nano to edit AdGuardHome.yaml

pkg install nano
nano /usr/local/bin/AdGuardHome.yaml

Now paste the xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx part after the line that says:
password:

So you'll have
password: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

ALT-X
Save Buffer? Hit Y (Yes)

Restart adguard
service adguardhome start

Win!
 

Dxtros

Dabbler
Joined
Feb 22, 2023
Messages
10
I tried this and the nano view of the .yaml file is just blank. How can I actually see it?
I was able to follow the process step by step it seems like the new password still isn't sticking still unfortunately.
 
Last edited:

Dxtros

Dabbler
Joined
Feb 22, 2023
Messages
10
I actually updated the nano and was able to follow the process step by step it seems like the new password still isn't sticking still unfortunately.
I think the issue is adguard is running the old config file and not the new one as I'm getting a message saying to choose which config to use, how do I select the new one?
 

Attachments

  • Screenshot 2023-02-23 151648.png
    Screenshot 2023-02-23 151648.png
    16.8 KB · Views: 299

Oatbag

Cadet
Joined
Nov 16, 2022
Messages
5
You could try copying the new config to both locations and that should work.
Your Adguard config is in AdGuardHome.yaml, make sure you're copying the correct one by viewing the file in nano first.

I've moved to TrueNAS Scale now so I can't test this on Core anymore.

I like having Debian underneath, but I'm a little puzzled by ACL lists on Scale.
 

Dxtros

Dabbler
Joined
Feb 22, 2023
Messages
10
Thanks for the response! I actually figured it out by using:

find / -name AdGuardHome.yaml

Which led me to the .yaml file on my system, then I used your process and it worked! Thank you so much for your documentation It’s the clearest one on the entire internet.
 

Oatbag

Cadet
Joined
Nov 16, 2022
Messages
5
Nice work! Yes that is a good command to find the file and it will work on both Linux and bsd.
Glad my guide worked for you!
 

McLuvn

Cadet
Joined
Jul 30, 2023
Messages
2
I used a combination of things in this thread... mostly from Oatbag's guide. TL;DR = success!

Used the Dashboard to stop the AdGuard service.
Dashboard >> Plugins >> AdGuard ... click the ">" at the far right, scroll down and click "Stop".

Opened a Shell from the Dashboard, used the "iocage console AdGuard" command to switch from root to the AdGuard jail.
(This was before I noticed you could just go "Dashboard >> Jails >> AdGuard ... click ">" and scroll down and click Shell)

In Shell, I couldn't find my .yaml file using the /usr/local/bin/ directory as noted, so I followed Dxtros cue and entered "find / -name AdGuardHome.yaml" and found that my file was in the /usr/local/etc/ directory instead. Made a mental note and moved on.

Next I installed nano; "pkg install nano" and when that was finished I opened my .yaml file "nano /usr/local/etc/AdGuardHome.yaml" and viola! Finally in where I needed to be.

Next, I went over to https://bcrypt.online and found a very simple hash generator. I typed in my desired password, left the "cost factor" where it was, and clicked "Generate Hash". Clicked the "copy" button and went back to my TrueNAS tab.

Arrowed over to the hash line of the password, erased what was there, pasted in my copied hash and while I was there I went ahead and took the liberty of changing the user name to something other than "admin". Used Control+O to write out the file, pressed Enter to keep the same file name, then Control+X to exit the nano editor.

With my new credentials in place, I used the dashboard to restart both the AdGuard jail and the AdGuard service.
Dashboard >> Jails >> AdGuard, click the ">" to expand, scroll down, click "Restart" and wait.
Dashboard >> Plugins >> AdGuard, click the ">" to expand, scroll down, click "Restart" and wait.

Now.. fair enough to say that I probably didn't need to restart the service itself because when I restarted the jail, it restarted the service as well, but I've wasted enough time beating my head against the wall on this project, what's another 30 seconds just to be sure.

Used my browser to navigate back to the AdGuard GUI, plugged in my newly minted credentials and got right in.

Thanks to all of you who contributed to this.. I'd have never figured this stuff out on my own!
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Next, I went over to https://bcrypt.online and found a very simple hash generator. I typed in my desired password, left the "cost factor" where it was, and clicked "Generate Hash". Clicked the "copy" button and went back to my TrueNAS tab.
So you are seriously suggesting to give a third party your unencrypted administrator password?

Better: ssh to your TrueNAS, enter this command:
Code:
htpasswd -nbBC 10 DUMMY topsecretpassword


The output looks like this:
Code:
DUMMY:$2y$10$uVE7EPCVujnB.UhaZknD9et6.suENADDD19OuKNpzrl7Cx38muFxq


The bcrypt hash is everything to the right of "DUMMY:"

HTH,
Patrick
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222

macmuchmore

Explorer
Joined
Feb 4, 2020
Messages
58
I used a combination of things in this thread... mostly from Oatbag's guide. TL;DR = success!

Used the Dashboard to stop the AdGuard service.
Dashboard >> Plugins >> AdGuard ... click the ">" at the far right, scroll down and click "Stop".

Opened a Shell from the Dashboard, used the "iocage console AdGuard" command to switch from root to the AdGuard jail.
(This was before I noticed you could just go "Dashboard >> Jails >> AdGuard ... click ">" and scroll down and click Shell)

In Shell, I couldn't find my .yaml file using the /usr/local/bin/ directory as noted, so I followed Dxtros cue and entered "find / -name AdGuardHome.yaml" and found that my file was in the /usr/local/etc/ directory instead. Made a mental note and moved on.

Next I installed nano; "pkg install nano" and when that was finished I opened my .yaml file "nano /usr/local/etc/AdGuardHome.yaml" and viola! Finally in where I needed to be.

Next, I went over to https://bcrypt.online and found a very simple hash generator. I typed in my desired password, left the "cost factor" where it was, and clicked "Generate Hash". Clicked the "copy" button and went back to my TrueNAS tab.

Arrowed over to the hash line of the password, erased what was there, pasted in my copied hash and while I was there I went ahead and took the liberty of changing the user name to something other than "admin". Used Control+O to write out the file, pressed Enter to keep the same file name, then Control+X to exit the nano editor.

With my new credentials in place, I used the dashboard to restart both the AdGuard jail and the AdGuard service.
Dashboard >> Jails >> AdGuard, click the ">" to expand, scroll down, click "Restart" and wait.
Dashboard >> Plugins >> AdGuard, click the ">" to expand, scroll down, click "Restart" and wait.

Now.. fair enough to say that I probably didn't need to restart the service itself because when I restarted the jail, it restarted the service as well, but I've wasted enough time beating my head against the wall on this project, what's another 30 seconds just to be sure.

Used my browser to navigate back to the AdGuard GUI, plugged in my newly minted credentials and got right in.

Thanks to all of you who contributed to this.. I'd have never figured this stuff out on my own!
This was excellent! However, I did not need to stop the AdGuard Plugin for this to work.
 
Top