Posted: Wed Apr 27, 2011 19:17 Post subject: dropbear scp call in a startup script (no tty)
Hi,
Has anybody been able to use the scp in a std/mega firmware build to fetch some files at router startup?
I have a 4MB flash router with std (nohotspot/nostor) with no space available if I enable jffs. I have a startup script that will write out a rsa key and add an entry to the known_host for another machine (192.168.1.2) that I want to pull files from.
However, scp refuses to work from the startup script script (logs an exit code of 1). If I just telnet/ssh in and run the /tmp/.rc_startup, then scp works! (no user input)
I've researched dropbear scp, but am unable to find something that would help me
I've tried scp with -t to emulate a terminal, tried ssh to the other machine (192.168.1.2) and run scp from there to the router... Nothing works
I have the same situation. My rc_startup script runs perfectly when activated manually by ssh. It also runs almost perfectly when started by, or contained in rc_startup. That means that when I put a bunch of echo traps in the script, I can see what it's doing and what it's not. Everything works except the scp calls. There is no apparent reason for it. I've tried:
/usr/bin/scp instead of scp in the script,
PATH=... to match the PATH that I have when logged on as ssh
No joy. It sure would be nice to get this working. I could use WGET or something, but standardizing on SCP across the script family has its advantages...
Kernel information:
Linux , 2.6.34.10 #225 Mon Oct 31 00:22:26 CET 2011 mips GNU/Linux
DD-WRT v24-sp2 std (c) 2011 NewMedia-NET GmbH
Release: 10/31/11 (SVN revision: 17798)
Buffalo WZR-HP-G300NH2
1) rc_startup loads a crontab file which tries to load my script every minute
2) the cron process starts my script using root so all works including scp
3) my script stops cron, removes the crontab file, then restarts cron so that it can do its system stuff but doesn't try to re-call my script every minute
Kludgy, but it works as if the rc_startup process called my script, except that scp works this way.