Changing the admin password using scripts

Thanks for all your help… as I feel like I am close to lift off.

The one problem that is now bothering me is how to change the admin password. I would also like to change the name of the admin account to something less obvious.

I am not sure if this is covered anywhere… though my preference is to do this using a bash / shell command.

PS>. I am also upgrading my skills in bash… I have always wanted to do this… and your examples help and old dog learn a few new tricks :slight_smile:

After deleting an identity.. I can now see a part of the answer.

You use a cmd like the following to create a new user

ziti edge create identity user reflectClient -o reflectClient.jwt

What is unclear is the difference between an edge user and controller admin user..

maybe I need to do some digging into that quickinstall script

Do you any tips to point me in the right direction

https://openziti.github.io/ziti/quickstarts/network/common-quickstart.html?q=password#tabpanel_Jgj2pEEE-E_change-pwd-cli

should render but when i looked at the doc it didn’t work and showed me only how to do it with the UI. I looked at the doc source code though. you can run:

ziti edge update authenticator updb -s
Enter your current password:
Enter your new password:
1 Like

issue filed to fix the doc - the command above should work tho Change pwd via CLI doc doesn't render · Issue #80 · openziti/ziti-doc · GitHub

1 Like

Thanks for the link… I noticed the following command… and file that has the admin password…

jq -r .password /home/nfadmin/.config/ziti/ziti-controller/credentials.json

I could not find this directory or file on my machine… though I did find the password in the env file

Any tips?

that’s the cached credential file. when you run zitiLogin it’ll go to your $ZITI_HOME folder. if you changed your admin password - you probably want to update the .env file which the quickstart generates. That’s usually in $HOME/.ziti/quickstart/$(hostname)/$(hostname).env

Then you will want to source that file again: source $HOME/.ziti/quickstart/$(hostname)/$(hostname).env and then you can run zitiLogin

1 Like

awesome… starting to learn how it all hangs together…

quick followup about this… because I want to check that what I am doing is correct.

I just reset the admin password… and noticed that you also have a flag to change the passwords for other identities :slight_smile:

I then closed the terminal… and reopened it… because I was not sure how to close an openZiti session…

I then reloaded the environment variables… and rerun the zitiLogin command.

however… when I inspected the $ZITI_HOME folder… I noticed that the file is called “ziti-cli.json” rather than “credential.json”.

Also… when I inspected “ziti-cli.json”… I noticed that it stores the token… rather than the password.

All ok… just checking if this is expected… or if the password is stored if you use another type of configuration

It’s all fine. I think the json file name was just changed and the doc is out of date. i’ll go find and update that. You can login using the ziti cli if you want as I showed below:

.ziti/quickstart/ip-172-31-42-64/ziti-bin/ziti-v0.25.3/ziti edge login localhost:8441
Untrusted certificate authority retrieved from server
Verified that server supplied certificates are trusted by server
Server supplied 6 certificates
Trust server provided certificate authority [Y/N]: yes
Server certificate chain written to /home/ubuntu/.config/ziti/certs/localhost
Enter username: admin
Enter password:
Token: 8c1b637d-b20e-47e4-8c9c-25b2951cf5a1
Saving identity 'default' to /home/ubuntu/.config/ziti/ziti-cli.json

after source the env file, when I issue zitiLogin it’ll put it in my $ZITI_HOME folder

zitiLogin
Token: 7a4ee0de-5ac8-45bb-aec6-9163a67121d6
Saving identity 'default' to /home/ubuntu/.ziti/quickstart/ip-172-31-42-64/ziti-cli.json
1 Like

Actually that link is out of date. I changed the two references however in reality that doc needs to get reworked. Still - I updated it. It should reflect soon enough.

1 Like