Setting admin password via SSH

I have several GL-MT300N-V2 routers I’m trying to configure in an automatic way. Connecting to their wifi and logging in via ssh is easy enough, but I’m unable to figure out how to set the admin password from the cli.

I’ve searched the configs for where the password is stored but didn’t find it, and tried to set it using the passwd command, which changed the ssh login password, but it the web interface password didn’t change with it. I’ve considered sending a POST request to http://192.168.8.1/cgi-bin/api/router/initpwd but I’d prefer to do everything over ssh if possible, at the moment this solution is my last resort.

Any ideas how to do this?

I can give you via private message. It is a little complicated and I don’t want to make this public.

alzhao sent me info via PM that worked to do this. If you’re doing the same thing I was, contact one of their staff for the details.

1 Like

What is the solution? Why don’t you want to make it public?
Can I ask for this hidden solution too?

Because that is not a normal use. There is no hidden solutions.

@Jake tell me his details scenario so I would like to help his case.

Can we make it public?

What is the solution?

I use a shell script to streamline the initial setup for multiple routers, which invokes ‘curl’ to POST to the ‘initpwd’ webAPI.

Check my original post from last year.

1 Like

Could you please send me a private message as I'd also like to be able to reset my GL UI password as currently I can only log in via SSH or luci.

Thanks.

router model and firmware version please?

For the ssh route i can help :+1:

In the cli you just have to type passwd and it should be saved into /etc/shadow

But for the api stuff by using a url, this is something i cannot help you with, but GL-iNet can :+1:

1 Like

Sorry, I realised that I missed that after I had posted and had gone to bed.

The model is GL-MT1300, the Firmware Version as reported by luci is:

OpenWrt 19.07.7 r11306-c4a6851c72 / LuCI openwrt-19.07 branch git-21.044.30835-34e0d65

Kernel Version
4.14.221

Many thanks.

It should be 3.x firmware. I suggest that you upgrade to 4.x.

But if you have to change password I need to find the solution. Haven’t do this for years.

I currently only have remote access, so I'm concerned about upgrading the firmware to 4.x and breaking something as it would be hard to recover from without travelling back to it. I'm also not sure how I would upgrade it to 4.x without being able to log into the gl.inet UI.

If you are able to assist me with it running on 3.x, I'd appreciate it. Even if you're not able to straight away, as it's not urgent, but I'd like to be able to change it in the next few weeks if possible.

I currently have a few Mudi E750 routers running 4.3.19. Would you please send me the instructions on how to change the admin password via SSH. Thank you for your time.

By simply calling passwd from inside the SSH session.

Thank you very much