Scripted adding password to OpenWRT

· 1 min read
Scripted adding password to OpenWRT

How to add password to default OpenWRT installation via script?

As default OpenWRT devices do not have password. That means you are not able to use ssh to access the device. What that means you are not able to upload any files via scp.

Here is script to log to the the OpenWRT device via telnet and add password to a root account.

OpenWRT needs some time to process change of password and to generate ssl certificates. Wait 60sec before trying to connect via ssh. After 60sec. you will have 100% success.

save as file and make executable as shell script chmod u+x script_file.sh

#!/bin/bash

# upload image onto linkit

# telnet 192.168.100.1
{ echo "passwd root"; sleep 2; echo "root"; sleep 1; echo "root"; sleep 4; echo "exit"; } | telnet 192.168.100.1

sleep 10
echo "password changed"

exit 0