forked from dpavlin/android-command-line
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadb-install-dropbear.sh
More file actions
executable file
·39 lines (29 loc) · 869 Bytes
/
adb-install-dropbear.sh
File metadata and controls
executable file
·39 lines (29 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh -xe
# http://wiki.cyanogenmod.org/w/Doc:_dropbear
pub=$HOME/.ssh/id_rsa.pub
cat $pub
adb push $pub /sdcard/authorized_keys
cat << EOF | adb shell
mkdir /data/dropbear
chmod 755 /data/dropbear
mkdir /data/dropbear/.ssh
chmod 700 /data/dropbear/.ssh
mv /sdcard/authorized_keys /data/dropbear/.ssh/
chown root: /data/dropbear/.ssh/authorized_keys
chmod 600 /data/dropbear/.ssh/authorized_keys
dropbearkey -t rsa -f /data/dropbear/dropbear_rsa_host_key
dropbearkey -t dss -f /data/dropbear/dropbear_dss_host_key
exit
EOF
adb pull /etc/init.local.rc /tmp/init.local.rc
grep dropbear /tmp/init.local.rc || (
cat << EOF >> /tmp/init.local.rc
# start Dropbear (ssh server) service on boot
service sshd /system/xbin/dropbear -s
user root
group root
oneshot
EOF
adb shell mount -o remount,rw /system
adb push /tmp/init.local.rc /etc/init.local.rc
)