Automatically entering ssh password from Busybox terminal

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












1















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 busybox@xx.xx.xx.xx 'ssh modem@xx.xx.xx.xx'


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.










share|improve this question
























  • Add your public key to the file ~/.ssh/authorized_keys at busybox@xx.xx.xx.xx.

    – Cyrus
    Sep 27 '15 at 23:00















1















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 busybox@xx.xx.xx.xx 'ssh modem@xx.xx.xx.xx'


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.










share|improve this question
























  • Add your public key to the file ~/.ssh/authorized_keys at busybox@xx.xx.xx.xx.

    – Cyrus
    Sep 27 '15 at 23:00













1












1








1








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 busybox@xx.xx.xx.xx 'ssh modem@xx.xx.xx.xx'


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.










share|improve this question
















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 busybox@xx.xx.xx.xx 'ssh modem@xx.xx.xx.xx'


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.







bash shell-script ssh busybox ash






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 27 '15 at 23:25







wvu_evan12

















asked Sep 27 '15 at 22:57









wvu_evan12wvu_evan12

64




64












  • Add your public key to the file ~/.ssh/authorized_keys at busybox@xx.xx.xx.xx.

    – Cyrus
    Sep 27 '15 at 23:00

















  • Add your public key to the file ~/.ssh/authorized_keys at busybox@xx.xx.xx.xx.

    – Cyrus
    Sep 27 '15 at 23:00
















Add your public key to the file ~/.ssh/authorized_keys at busybox@xx.xx.xx.xx.

– Cyrus
Sep 27 '15 at 23:00





Add your public key to the file ~/.ssh/authorized_keys at busybox@xx.xx.xx.xx.

– Cyrus
Sep 27 '15 at 23:00










2 Answers
2






active

oldest

votes


















0














You need to use expect (or similar such as perl's Expect.pm module, or even perl's Net::SSH module...or the python pexpect module if you prefer python) on your Ubuntu server to:



  • connect to the busybox system, either with a password or with a key

  • when you get a shell prompt, issue the ssh command to get to the modem

  • when you see the password prompt, send the password

  • issue whatever commands you need to the modem

  • exit from the modem, and then from the busybox server





share|improve this answer























  • So you're saying the expect command will work if run from the ubuntu server and won't matter if expect isnt installed in the busybox system?

    – wvu_evan12
    Sep 27 '15 at 23:27











  • Yep. Your expect script will run on the ubuntu server, connect to busybox server and then connect to the modem. i.e. it runs entirely on the ubuntu server.

    – cas
    Sep 27 '15 at 23:47


















0














If you have a key to authenticate to the intermediate BusyBox system and you need the password for the final system, just call sshpass on the original Ubuntu system, and call ssh -t to reach the BusyBox system so that there will be a terminal for the inner ssh command to read its password.



sshpass -p modempassword ssh -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx


If you also need to use a password for the BusyBox system, you'll need to call sshpass twice.



sshpass -p busyboxpassword sshpass -p modempassword ssh -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx


If for some reason you're having trouble with the connection setup, you can do it in two steps:




  1. Open up a master connection to the BusyBox system. This only requires support on the client, nothing special on the server.



    sshpass -p busyboxpassword ssh -o ControlMaster=auto -f busybox@xx.xx.xx.x sleep 999999999



  2. Use a slave connection to the BusyBox system to open a connection to the modem.



    sshpass -p modempassword ssh -o ControlMaster=auto -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx



  3. When you've finished, close the master connection with



    ssh -O exit busybox@xx.xx.xx.xx






share|improve this answer
























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f232415%2fautomatically-entering-ssh-password-from-busybox-terminal%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You need to use expect (or similar such as perl's Expect.pm module, or even perl's Net::SSH module...or the python pexpect module if you prefer python) on your Ubuntu server to:



    • connect to the busybox system, either with a password or with a key

    • when you get a shell prompt, issue the ssh command to get to the modem

    • when you see the password prompt, send the password

    • issue whatever commands you need to the modem

    • exit from the modem, and then from the busybox server





    share|improve this answer























    • So you're saying the expect command will work if run from the ubuntu server and won't matter if expect isnt installed in the busybox system?

      – wvu_evan12
      Sep 27 '15 at 23:27











    • Yep. Your expect script will run on the ubuntu server, connect to busybox server and then connect to the modem. i.e. it runs entirely on the ubuntu server.

      – cas
      Sep 27 '15 at 23:47















    0














    You need to use expect (or similar such as perl's Expect.pm module, or even perl's Net::SSH module...or the python pexpect module if you prefer python) on your Ubuntu server to:



    • connect to the busybox system, either with a password or with a key

    • when you get a shell prompt, issue the ssh command to get to the modem

    • when you see the password prompt, send the password

    • issue whatever commands you need to the modem

    • exit from the modem, and then from the busybox server





    share|improve this answer























    • So you're saying the expect command will work if run from the ubuntu server and won't matter if expect isnt installed in the busybox system?

      – wvu_evan12
      Sep 27 '15 at 23:27











    • Yep. Your expect script will run on the ubuntu server, connect to busybox server and then connect to the modem. i.e. it runs entirely on the ubuntu server.

      – cas
      Sep 27 '15 at 23:47













    0












    0








    0







    You need to use expect (or similar such as perl's Expect.pm module, or even perl's Net::SSH module...or the python pexpect module if you prefer python) on your Ubuntu server to:



    • connect to the busybox system, either with a password or with a key

    • when you get a shell prompt, issue the ssh command to get to the modem

    • when you see the password prompt, send the password

    • issue whatever commands you need to the modem

    • exit from the modem, and then from the busybox server





    share|improve this answer













    You need to use expect (or similar such as perl's Expect.pm module, or even perl's Net::SSH module...or the python pexpect module if you prefer python) on your Ubuntu server to:



    • connect to the busybox system, either with a password or with a key

    • when you get a shell prompt, issue the ssh command to get to the modem

    • when you see the password prompt, send the password

    • issue whatever commands you need to the modem

    • exit from the modem, and then from the busybox server






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 27 '15 at 23:24









    cascas

    39.1k454101




    39.1k454101












    • So you're saying the expect command will work if run from the ubuntu server and won't matter if expect isnt installed in the busybox system?

      – wvu_evan12
      Sep 27 '15 at 23:27











    • Yep. Your expect script will run on the ubuntu server, connect to busybox server and then connect to the modem. i.e. it runs entirely on the ubuntu server.

      – cas
      Sep 27 '15 at 23:47

















    • So you're saying the expect command will work if run from the ubuntu server and won't matter if expect isnt installed in the busybox system?

      – wvu_evan12
      Sep 27 '15 at 23:27











    • Yep. Your expect script will run on the ubuntu server, connect to busybox server and then connect to the modem. i.e. it runs entirely on the ubuntu server.

      – cas
      Sep 27 '15 at 23:47
















    So you're saying the expect command will work if run from the ubuntu server and won't matter if expect isnt installed in the busybox system?

    – wvu_evan12
    Sep 27 '15 at 23:27





    So you're saying the expect command will work if run from the ubuntu server and won't matter if expect isnt installed in the busybox system?

    – wvu_evan12
    Sep 27 '15 at 23:27













    Yep. Your expect script will run on the ubuntu server, connect to busybox server and then connect to the modem. i.e. it runs entirely on the ubuntu server.

    – cas
    Sep 27 '15 at 23:47





    Yep. Your expect script will run on the ubuntu server, connect to busybox server and then connect to the modem. i.e. it runs entirely on the ubuntu server.

    – cas
    Sep 27 '15 at 23:47













    0














    If you have a key to authenticate to the intermediate BusyBox system and you need the password for the final system, just call sshpass on the original Ubuntu system, and call ssh -t to reach the BusyBox system so that there will be a terminal for the inner ssh command to read its password.



    sshpass -p modempassword ssh -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx


    If you also need to use a password for the BusyBox system, you'll need to call sshpass twice.



    sshpass -p busyboxpassword sshpass -p modempassword ssh -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx


    If for some reason you're having trouble with the connection setup, you can do it in two steps:




    1. Open up a master connection to the BusyBox system. This only requires support on the client, nothing special on the server.



      sshpass -p busyboxpassword ssh -o ControlMaster=auto -f busybox@xx.xx.xx.x sleep 999999999



    2. Use a slave connection to the BusyBox system to open a connection to the modem.



      sshpass -p modempassword ssh -o ControlMaster=auto -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx



    3. When you've finished, close the master connection with



      ssh -O exit busybox@xx.xx.xx.xx






    share|improve this answer





























      0














      If you have a key to authenticate to the intermediate BusyBox system and you need the password for the final system, just call sshpass on the original Ubuntu system, and call ssh -t to reach the BusyBox system so that there will be a terminal for the inner ssh command to read its password.



      sshpass -p modempassword ssh -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx


      If you also need to use a password for the BusyBox system, you'll need to call sshpass twice.



      sshpass -p busyboxpassword sshpass -p modempassword ssh -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx


      If for some reason you're having trouble with the connection setup, you can do it in two steps:




      1. Open up a master connection to the BusyBox system. This only requires support on the client, nothing special on the server.



        sshpass -p busyboxpassword ssh -o ControlMaster=auto -f busybox@xx.xx.xx.x sleep 999999999



      2. Use a slave connection to the BusyBox system to open a connection to the modem.



        sshpass -p modempassword ssh -o ControlMaster=auto -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx



      3. When you've finished, close the master connection with



        ssh -O exit busybox@xx.xx.xx.xx






      share|improve this answer



























        0












        0








        0







        If you have a key to authenticate to the intermediate BusyBox system and you need the password for the final system, just call sshpass on the original Ubuntu system, and call ssh -t to reach the BusyBox system so that there will be a terminal for the inner ssh command to read its password.



        sshpass -p modempassword ssh -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx


        If you also need to use a password for the BusyBox system, you'll need to call sshpass twice.



        sshpass -p busyboxpassword sshpass -p modempassword ssh -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx


        If for some reason you're having trouble with the connection setup, you can do it in two steps:




        1. Open up a master connection to the BusyBox system. This only requires support on the client, nothing special on the server.



          sshpass -p busyboxpassword ssh -o ControlMaster=auto -f busybox@xx.xx.xx.x sleep 999999999



        2. Use a slave connection to the BusyBox system to open a connection to the modem.



          sshpass -p modempassword ssh -o ControlMaster=auto -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx



        3. When you've finished, close the master connection with



          ssh -O exit busybox@xx.xx.xx.xx






        share|improve this answer















        If you have a key to authenticate to the intermediate BusyBox system and you need the password for the final system, just call sshpass on the original Ubuntu system, and call ssh -t to reach the BusyBox system so that there will be a terminal for the inner ssh command to read its password.



        sshpass -p modempassword ssh -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx


        If you also need to use a password for the BusyBox system, you'll need to call sshpass twice.



        sshpass -p busyboxpassword sshpass -p modempassword ssh -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx


        If for some reason you're having trouble with the connection setup, you can do it in two steps:




        1. Open up a master connection to the BusyBox system. This only requires support on the client, nothing special on the server.



          sshpass -p busyboxpassword ssh -o ControlMaster=auto -f busybox@xx.xx.xx.x sleep 999999999



        2. Use a slave connection to the BusyBox system to open a connection to the modem.



          sshpass -p modempassword ssh -o ControlMaster=auto -t busybox@xx.xx.xx.xx ssh modem@xx.xx.xx.xx



        3. When you've finished, close the master connection with



          ssh -O exit busybox@xx.xx.xx.xx







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 13 '17 at 12:36









        Community

        1




        1










        answered Sep 27 '15 at 23:53









        GillesGilles

        538k12810881605




        538k12810881605



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f232415%2fautomatically-entering-ssh-password-from-busybox-terminal%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?