SSH + Root Access on Xiaomi Mi Router Nano / Lite / Youth
A Software Engineer passionate about public good projects and making technology to serve society en masse.
Obtaining ssh access along with root is as simple as flashing the Developer ROM and setting the root password via a POST request. However, the Developer ROM is completely in Chinese. Thus, it is advisable to have a copy of Google Chrome installed for automatic translation. Let’s get started.
Download the Official Developer ROM
Visit http://192.168.31.1, login and manually upgrade to the Official Developer ROM. Ignore any warning regarding downgrading.
Wait for 5-7 minutes. After the router is back on again, you need to set a root password to be able to log in. Login to the router and copy the “stok” but from the address bar. Open up a shell and,
curl -d "oldPwd=your_admin_pass&newPwd=desired_root_pass" \
"http://192.168.31.1/cgi-bin/luci/;stok=<stok from browser url>/api/xqsystem/set_name_password"
Now a response should indicate a code. If the code is set to 0, you have successfully set your password. Otherwise if you receive a text in chinese, translate that to figure out what is wrong.
Happy Hacking!