I currently am attempting to reboot a modem via ssh using a bash script. For reasons I don't feel like explaining, I NEED to start on an ubuntu server computer, ssh into a setup running busybox 1.21.1 and then ssh into the modem from there and reboot it.
I need the busybox system to automatically input the password when sshing into the modem.
To do this when sshing into the busybox system from the ubuntu server, I use sshpass
in the following:
sshpass -p password ssh [email protected] 'ssh [email protected]'
and running this gets me to the password prompt for the modem.
My problem is that the busybox system only has a small amount of commands available for use and none of them are sshpass
or expect
, which are the only two commands I know to use to automatically interact with the ssh password prompt.
The defined functions on the busybox installation are
[, [[, addgroup, adduser, ar, arping, ash, awk, basename, blkid, bunzip2, bzcat,
cat, catv, chattr, chgrp, chmod, chown, chroot, chrt, chvt, cksum, clear, cmp,
cp, cpio, crond, crontab, cut, date, dc, dd, deallocvt, delgroup, deluser, devmem,
df, diff, dirname, dmesg, dnsd, dnsdomainname, dos2unix, du, dumpkmap, echo,
egrep, eject, env, ether-wake, expr, false, fdflush, fdformat, fgrep, find, fold,
free, freeramdisk, fsck, fuser, getopt, getty, grep, gunzip, gzip, halt, hdparm,
head, hexdump, hostid, hostname, hwclock, id, ifconfig, ifdown, ifup, inetd, init,
insmod, install, ip, ipaddr, ipcrm, ipcs, iplink, iproute, iprule, iptunnel, kill,
killall, killall5, klogd, last, less, linux32, linux64, linuxrc, ln, loadfont,
loadkmap, logger, login, logname, losetup, ls, lsattr, lsmod, lsof, lspci, lsusb,
lzcat, lzma, makedevs, md5sum, mdev, mesg, microcom, mkdir, mkfifo, mknod, mkswap,
mktemp, modprobe, more, mount, mountpoint, mt, mv, nameif, netstat, nice, nohup,
nslookup, od, openvt, passwd, patch, pidof, ping, pipe_progress, pivot_root,
poweroff, printenv, printf, ps, pwd, rdate, readlink, readprofile, realpath,
reboot, renice, reset, resize, rm, rmdir, rmmod, route, run-parts, runlevel, sed,
seq, setarch, setconsole, setkeycodes, setlogcons, setserial, setsid, sh, sha1sum,
sha256sum, sha3sum, sha512sum, sleep, sort, start-stop-daemon, strings, stty, su,
sulogin, swapoff, swapon, switch_root, sync, sysctl, syslogd, tail, tar, tee,
telnet, test, tftp, time, top, touch, tr, traceroute, true, tty, udhcpc, umount,
uname, uniq, unix2dos, unlzma, unxz, unzip, uptime, usleep, uudecode, uuencode,
vconfig, vi, vlock, watch, watchdog, wc, wget, which, who, whoami, xargs, xz,
xzcat, yes, zcat
Does anyone know of anything I can use to automatically input this password when sshing from the the busybox system into the modem?
Any help or ideas would be appreciated
EDIT: ssh key authentication is a no go due to lack of support from the modem.
Edit2: could someone at least comment and let me know if the question I'm asking makes that much sense? Trying hard to get a clear explanation of my problem so someone with the real know how can help me. Let me know if there's any part to my question that is confusing or if there is more detail I can provide.