how to auto-logon thru ssh in Busybox?

Discussion in 'Tomato Firmware' started by quinezhu, Dec 19, 2008.

  1. quinezhu

    quinezhu Addicted to LI Member

    hi, all

    how can i realize auto-logon to a remote server (no public key, just password required) thru ssh in Busybox? A sample script needs installing EXPECT on Tomato but i still wanna a non-EXPECT method. Thx in adv.
  2. ntest7

    ntest7 Network Guru Member


    DROPBEAR_PASSWORD='my password' ssh user@remote
  3. quinezhu

    quinezhu Addicted to LI Member

    many thx, it works :)

    then, how to auto-execute the next command line such as 'exit' after auto-logon to the remote sever? I've added 'exit' in the next line of 'DROPBEAR_PASSWORD=...' but it seems 'exit' starts to excute before ssh auto-logon finished. Then I add semicolon or 'sleep 5' between the two command lines but still doesn't work. :confused: I'm a linux newbie. :biggrin:
  4. fyellin

    fyellin LI Guru Member

    You're misunderstanding how "ssh" executes commands.

    You essentially have two choices. The simplest, if you want to execute a single command is just
    ssh me@targetMachine ls /
    which will execute the command "ls /" on the target machine.

    If you want to execute multiple commands then
    ssh me@targetMachine << END
    command 1
    command 2
    command 3
    which will execute each of the commands, in order, on the target machine. You do not need to include an "exit" or "logout".
  5. quinezhu

    quinezhu Addicted to LI Member

    thx a lot.

    sorry for no explanation that the target machine is XP with SSH server installed so CMD will be encountered after auto-logon. i just wanna auto-execute several batch files predefined on the target machine then auto-return to Busybox in tomato.

    i've tried above two methods but it doesn't work.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice