Page 1 of 1
Changing a user's password via terminal
Posted: Sun Jul 21, 2013 2:46 am
by eben
How do I change a user's password via the terminal.
Let's say user admin is user 0 on the list. What's the /user ... command to change the password?
Thanks
Re: Changing a user's password via terminal
Posted: Mon Jul 22, 2013 2:46 am
by omega-00
ros code
/user set [find name=username] password=password
Is this what you're looking for?
Re: Changing a user's password via terminal
Posted: Mon Jul 22, 2013 6:28 am
by eben
ros code
/user set [find name=username] password=password
Is this what you're looking for?
That is perfect. Thank you.
Re: Changing a user's password via terminal
Posted: Tue Jul 23, 2013 2:53 am
by Chupaka
well,
/user set admin password=bla-bla
works fine for me
![Smile :)](./images/smilies/icon_smile.gif)
Re: Changing a user's password via terminal
Posted: Tue Jul 23, 2013 5:29 am
by omega-00
That is correct, we both missed covering edge cases though.. IE:
ros code
/user set [find name="michael.o'hara"] password=test123
Which works, but will not work if you try it with either of our original examples:
ros code
/user set michael.o'hara password=test123
or
ros code
/user set [find name=michael.o'hara] password=password
Here's to best practise and people with weird names hahahah
Edit: As pointed out usernames with 's are not allowed as router users, they are however able to be created as ppp secrets (and I'm assuming as usermanager accounts?)
Re: Changing a user's password via terminal
Posted: Tue Jul 23, 2013 10:07 am
by normis
if a person uses michael.o'hara as his login name, he can only blame himself
![Smile :)](./images/smilies/icon_smile.gif)
Re: Changing a user's password via terminal
Posted: Tue Jul 23, 2013 1:34 pm
by Chupaka
well, I can't create a user with apostrophe or space in the name (router says 'Invalid user name') - so edge cases are cut by smart routerOS
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Re: Changing a user's password via terminal
Posted: Tue Jul 23, 2013 1:36 pm
by normis
well, I can't create a user with apostrophe or space in the name (router says 'Invalid user name') - so edge cases are cut by smart routerOS
![Very Happy :D](./images/smilies/icon_biggrin.gif)
http://xkcd.com/327/
Re: Changing a user's password via terminal
Posted: Wed Jul 24, 2013 5:40 am
by omega-00
well, I can't create a user with apostrophe or space in the name (router says 'Invalid user name') - so edge cases are cut by smart routerOS
![Very Happy :D](./images/smilies/icon_biggrin.gif)
I know I'm being pedantic, but you can create those in other areas (like ppp secrets etc) so if someone is trying to use the same code for other similar functions they
might run into that.
Poor Michael O'Hara.. or in our case I managed to find an existing customer with the last name
Fox-d'Alpuget.. one day I'll name my Son Timo+hy so he has a terrible time getting email addresses for work or uni
![Very Happy :-D](./images/smilies/icon_biggrin.gif)
Re: Changing a user's password via terminal
Posted: Wed Jul 24, 2013 9:55 am
by normis
Off topic, but your son would simply get the address
timo@something.com because using +hy is a valid tagging system for filtering mail. Ie. sending something to
timo+hy@something.com would go to
timo@something.com
Re: Changing a user's password via terminal
Posted: Thu Dec 24, 2015 10:53 am
by vazhagelashvili
well,
/user set admin password=bla-bla
works fine for me
![Smile :)](./images/smilies/icon_smile.gif)
Hi,I wonder how to list users .Thanks in advance!
Re: Changing a user's password via terminal
Posted: Thu Feb 09, 2017 7:32 pm
by Almohalla
well,
/user set admin password=bla-bla
works fine for me
![Smile :)](./images/smilies/icon_smile.gif)
Hi,I wonder how to list users .Thanks in advance!
to list users
Re: Changing a user's password via terminal
Posted: Wed Feb 01, 2023 2:36 am
by LaZyLion
Is there a way to mask a password in a script?
Instead of
/user set admin password=bla-bla
you'd use
/user set admin password-md5=f56e8aca4cdfaefba307865a179e28a7
Field techs can have user-level passwords, but I'd like to at least pretend I'm protecting my admin passwords from curious Georges.