scp works just fine for me (in server mode, for copying stuff to/from my phone). What exactly was the command that failed?
I was trying to copy a file from my server to my phone the command was
scp somefile root@phoneip:/sdcard
it prompts me for the password logs in then the error is shown
adb push dropbear /sdcard/dropbear
adb push dropbearkey /sdcard/dropbearkey
$ su
# mkdir /data/local/bin
# cp /sdcard/dropbear /data/local/bin/dropbear
# cp /sdcard/dropbear /data/local/bin/dropbearkey
# chmod 755 /data/local/bin/dropbear
# chmod 755 /data/local/bin/dropbearkey
# chown root.root /data/local/bin/dropbear
# chown root.root /data/local/bin/dropbearkey
# busybox mount -o remount,rw /dev/block/mtdblock3 /system
# echo "root:x:0:0::/:/system/bin/sh" > /etc/passwd
# echo "root::14531:0:99999:7:::" > /etc/shadow
# echo "root:x:0:" > /etc/group
# echo "root:!::" > /etc/gshadow
# echo "/system/bin/sh" > /etc/shells
# echo "PATH=\"/usr/bin:/usr/sbin:/bin:/sbin:/system/sbin:/system/bin:/system/xbin:/system/xbin/bb:/data/local/bin\"" > /etc/profile
# echo "export PATH" >> /etc/profile
# busybox passwd
Changing password for root
New password:
Bad password: too weak
Retype password:
Password for root changed by root
# mkdir /data/dropbear
# /data/local/bin/dropbearkey -t rsa -f /data/dropbear/dropbear_rsa_host_key
# /data/local/bin/dropbearkey -t dss -f /data/dropbear/dropbear_dss_host_key
# ln -s /data/dropbear /system/etc/dropbear
# busybox mount -o remount,ro /dev/block/mtdblock3 /system
/data/local/bin/dropbear
debian:~$ ssh root@xxx.xxx.xxx.xxx
root@xxx.xxx.xxx.xxx's password:
/data/dropbear #
ssh root@xxx.xxx.xxx.xxx
root@xxx.xxx.xxx.xxx's password:
Permission denied, please try again.
passwd: applet not found
can someone explain wat exactly running dropbear on the g1 allows us 2 do? im just a little confused
I'm trying all this on my MT3G with Cyanogen 4.2.3, and all was going fine until i try changing the password with "busybox passwd", to which i get the following error...
Code:passwd: applet not found
I'm not even sure how to proceed from here, any ideas?
adb push busybox.bin /data/local/bin/busybox
adb shell
chown root.root /data/local/bin/busybox
chmod 4755 /data/local/bin/busybox
/data/local/bin/busybox passwd
I don't have the original binaries posted in this thread, but I have ones I compiled myself. It's dropbear-0.52 with patches from:
Mostly the former with just the openpty function from the latter (because it couldn't open a pty otherwise on my Samsung Galaxy).
Just put dropbear, dropbearkey and scp in /system/bin and then start dropbear as described in the first link.
Yay, thanks a lot, this one works nice.
One thing that maybe isn´t clear at first is that you need to generate the rsa.secret file using this:
dropbearkey -t rsa -f /data/local/rsa/rsa.secret
and so you start the daemon with any password, lets say, "alpine" with this:
dropbear -A -N root -U 0 -G 0 -C alpine -r /data/local/rsa/rsa.secret -p 0.0.0.0:22
But manually issue that command everytime you boot your device is a pain. Any hint about how to make it start automatically? Sorry for this question, but i´m new to this. Comming from "unofficial" iPhone dev scene... Thanks
echo "dropbear -A -N root -U 0 -G 0 -C alpine -r /data/local/rsa/rsa.secret -p 0.0.0.0:22" >> /sdcard/startdropbear.sh
sh /sdcard/startdropbear.sh
busybox mount -o rw,remount /system
cp /sdcard/startdropbear.sh /system/bin/
chmod 4755 /system/bin/startdropbear.sh
busybox mount -o ro,remount /system
Hi Firehat
Thanks for the heads up on this. I actually took some time researching before posting this.
I actually have a nexus one here, and searched the entire filesystem for a place or file to be edited in order to have this command running automatically on boot or something.
Still no luck here, since this seems to be a tiny linux thing running, and a lot of things were left out. So there´s no init.d, or system/etc/init.d or anything i could find that seems closer to it.
Also did a .sh and gave it the execute permission for any user, also setting it´s group and ownership the same as some scripts i found in the filesystem, and placed this script into the same directories the other scripts are placed, but still no go about having it being auto executed.
if [ ! -d /etc/dropbear/ ]
then
/system/bin/mkdir /etc/dropbear/
fi
if [ ! -f /etc/dropbear/dropbear_rsa_host_key ]
then
/system/bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
fi
if [ ! -f /etc/dropbear/dropbear_dss_host_key ]
then
/system/bin/dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
fi
/system/bin/logwrapper /system/bin/dropbear -A -N root -U 0 -G 0 -C cocacola &
sh: can't access tty; job control turned off
cd /system/bin
telnetd
netstat
mount -o remount,rw /dev/block/mtdblock3 /system
dd if=/sdcard/download/busybox.asc of=/system/bin/busybox
chmod 4755 /system/bin/busybox
cd /system/bin
busybox cp -s busybox cp
mkdir /system/etc/dropbear
cp /sdcard/download/android-dropbear-0.51.rev1.asc /system/bin/dropbear
cp /sdcard/download/android-dropbearkey-0.51.rev1.asc /system/bin/dropbearkey
chmod 4755 /system/bin/dropbear
chmod 4755 /system/bin/dropbearkey
dropbearkey -t rsa -f /system/etc/dropbear/dropbear_rsa_host_key
dropbearkey -t dss -f /system/etc/dropbear/dropbear_dss_host_key
dropbear
ps
netstat
ssh root@<ip address of G1>
#!/system/bin/sh
dropbear -A paul -C <password> -R /system/etc/dropbear/authorized_keys -U0 -G0
mount -o remount,rw /system
cp /sdcard/dropbear /system/bin/dropbear
cp /sdcard/dropbearkey /system/bin/dropbearkey
cp /sdcard/95dropbear /system/etc/init.d/95dropbear
chmod 755 /system/bin/dropbear /system/bin/dropbearkey /system/etc/init.d/95dropbear
adb remount
adb push dropbear /system/bin/dropbear
adb push dropbearkey /system/bin/dropbearkey
adb push 95dropbear /system/etc/init.d/95dropbear
adb shell chmod 755 /system/bin/dropbear /system/bin/dropbearkey /system/etc/init.d/95dropbear