Change Password Web Command Line

luizfn

Joined
May 3, 2010
Messages
1
Likes
0
Points
0
#1
Good afternoon

We have a centralized Elastix installed on a client of ours and even changed the password from the web, now we need to support the central goals so that now he does not remember the password, would now be the procedure for making the change via the command line?

I thank you for your help.
Thanks
 

feder67

Joined
Jan 6, 2010
Messages
33
Likes
0
Points
0
#2
/usr/bin/sqlite3 /var/www/db/acl.db "UPDATE acl_user SET md5_password = '`echo -n newpass|md5sum|cut -d ' ' -f 1`' WHERE name = 'admin'"
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#3
feder67:

If you "copy and paste" my code please give me credit:

http://www.elastix.org/component/option ... ,en/#22785

which says:

/usr/bin/sqlite3 /var/www/db/acl.db "UPDATE acl_user SET md5_password = '`echo -n imanidiotandforgotmypassword|md5sum|cut -d ' ' -f 1`' WHERE name = 'admin'"

your version misses my whimsy and is boring.

and you forgot the important bit:

(change the imanidiotandforgotmypassword to suit. :) ) , because if they forget their password how will they understand that newpass is just an example.

luizfn :

NOBODY should be logging in on the admin account apart from the administrator(s)and I assume you didn't forget it ;) , so replace admin with the account of the idiot who DID forget his password.

If it is your FreePBX password he (or you) forgot, (I assume you have changed it from the default "admin" or preferably removed the admin account totally, if you haven't yet then PLEASE DO SO ASAP) and not your Elastix password then

sed -i 's/^AUTHTYPE=database/AUTHTYPE=none/' /etc/amportal.conf

open a new FreePBX session in your browser (no password needed), setup your new and not to be forgotten accounts/passwords,
then

sed -i 's/^AUTHTYPE=none/AUTHTYPE=database/' /etc/amportal.conf

and you are good to go

dicko
 

Amphibian

Joined
Sep 8, 2009
Messages
1,128
Likes
2
Points
38
#4
Hey Dicko,

I had a scheduled password change this morning, which I did. After I did the change I couldn't access any user with their new password. So after researching this and seeing your post I entered the one liner as you have listed:

/usr/bin/sqlite3 /var/www/db/acl.db "UPDATE acl_user SET md5_password = '`echo -n mypassword|md5sum|cut -d ' ' -f 1`' WHERE name = 'admin'"

and it keeps saying: "SQL error: file is encrypted or is not a database" ...

I tried to look at the file where it is stored and see that it is a blank page.

If I remember correctly this machine has Elastix 1.6..... (I know that doesn't help much)

Any suggestions, is there a way to Web access FreePBX and try it that way or do you have better suggestion?


Am I correct that the passwords can be up to 15 in length, use numbers or letters and accepts !, ?, ect....?

Thanks
Amphibian
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#5
You seem to be not using the correct acl.db I believe I remember that a long time ago it was in /var/www/html (without the db ) an

updatedb;locate acl.db

should track'm down.

An sqlite3 reference can be found at:-

http://www.sqlite.org/sqlite.html

thusly:-

/usr/bin/sqlite3 /var/www/db/acl.db ".tables" would give results when you find it,

you can turn off the ACL in unembedded FreePBX by changing AUTHTYPE to none and restarting amportal, (change it back after you did your dirty deeds)

dicko
 

Amphibian

Joined
Sep 8, 2009
Messages
1,128
Likes
2
Points
38
#6
Thank Dicko you for responding so quickly.

The acl.db is located in /var/www/db as acl.db.

I tried to look at it with sqlite3 originally and when entering .tables or any other command to look at this database, it says : "Error: file is encrypted or is not a database"

Would you recommend replacing it and if so what table, field or what ever will be required or is there a way to regenerate this file from cli?

As to Amportal.conf, changing that to none, does it bypass the welcome sign in where I can go and redo passwords???? or, is that just making freepbx accessible without a passwd? If I can get to FreePbx I should be able to reset passwords from there correct? and if so, do you do 192.168.1.1/freepbx to get to it?


Thanks Again
Amphibia
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#7
Now is the time to go for your backup from yesterday, (or the last one you did :) or should that be :eek:hmy: ) the file is apparently hosed. You probably only need to retrieve that file from the tarball though.

But the bigger question is what hosed it? True sqlite3 is not a very robust database but I have never seen that behavior myself.

As the the amportal thing, then yes, you are totally open at that point in time, hence my caution.



dicko
 

Amphibian

Joined
Sep 8, 2009
Messages
1,128
Likes
2
Points
38
#8
Thank you sir,

I knew you were going to say that some how, and yes, I do have the backup.

Thanks once again, your knowledge has been very helpful.


Amphibian
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#9
Amphibian:

You didn't let me down!

karma++ to you, and to anybody who reads this "did you back-it up yesterday before you broke it today?"
 

Amphibian

Joined
Sep 8, 2009
Messages
1,128
Likes
2
Points
38
#10
I didn't let you down. I really appreciate your help. I did back it up and could have done a restore but I thought if I could just simply enter a command of some sort to restore or rebuild just that file I would try.

I did the restore to a previous, but there still an issue.

When I enter a password like this for example " IamanidoT01234! " it seem to trash the file. If I just do a simple one like " abjslu1234 " no prob, so I am assuming that its not liking passwords with ! ? # entered???

Once again thank you

Amphibian
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#11
That is quite believable, I think you should file a bug in the bug-tracker below, if the php code doesn't reject that which it can't handle, it up it might well write gibberish into that file.

You probably just needed the one file rather than a whole backup, for educational purposes, try mc and drill into the backup tar ball you are using, yes you could write sqlite statement to re-generate the whole file, but the effort would I believe be out of proportion to the problem,

So the work around until you get that bug fixed is to just "Don't do that" :)

regards

dicko
 

Amphibian

Joined
Sep 8, 2009
Messages
1,128
Likes
2
Points
38
#12
Thank you.

I have tried several times to pull up the acl.db in sqlite3 to see what tables and other info is in that file, to no avail, even when pulling it off a "good" machine, am if able to see the info by entering .tables. It continues to say "its encrypted or is not a database. So I must being doing something wrong or I just don't have my sql opp's down like my old ignorant ass should have (after all I haven't written any sql statments in over five years). Getting to many brain farts these days to keep up with it all I think.

Now I pulled this file off another machine to get it to at least let me in, but when I go to make a change or add another user it throws errors every where. So I can ass------ume that it doest like to use a file from another machine only the one that was originally compiled/built during initial installation?

Oh well, have a great day, and may all of us "old farts" (not you) remember most of what we have forgotten that the young ones are just now learning....

Amphibian
 

Aussie Pho Bro

Joined
Jul 12, 2010
Messages
3
Likes
0
Points
0
#13
Dicko, your command

/usr/bin/sqlite3 /var/www/db/acl.db "UPDATE acl_user SET md5_password = '`echo -n imanidiotandforgotmypassword|md5sum|cut -d ' ' -f 1`' WHERE name = 'admin'"

worked like a charm. Thank you so much. Wish I could give many many Karma for that one.

Cheers
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#14
Thanks, but it is just a one liner of Rafael's original work. The credit and karma belongs to him.

dicko
 

chandra_tkc

Joined
Sep 11, 2012
Messages
5
Likes
0
Points
0
#15
it's worked..
thanks..
:D
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,902
Messages
130,887
Members
17,565
Latest member
omarmenichetti
Top