7 DSA_KEY=/data/ssh/ssh_host_dsa_key
8 DSA_PUB_KEY=/data/ssh/ssh_host_dsa_key.pub
9 RSA_KEY=/data/ssh/ssh_host_rsa_key
10 RSA_PUB_KEY=/data/ssh/ssh_host_rsa_key.pub
11 AUTHORIZED_KEYS=/data/ssh/authorized_keys
12 DEFAULT_AUTHORIZED_KEYS=/system/etc/security/authorized_keys.default
14 if [ ! -f $DSA_KEY ]; then
15 /system/bin/ssh-keygen -t dsa -f $DSA_KEY -N ""
17 chmod 644 $DSA_PUB_KEY
20 if [ ! -f $RSA_KEY ]; then
21 /system/bin/ssh-keygen -t rsa -f $RSA_KEY -N ""
23 chmod 644 $RSA_PUB_KEY
26 if [[ ! -f $AUTHORIZED_KEYS && -f $DEFAULT_AUTHORIZED_KEYS ]]; then
27 cat $DEFAULT_AUTHORIZED_KEYS > $AUTHORIZED_KEYS
31 if [ "1" == "$DEBUG" ] ; then
32 # run sshd in debug mode and capture output to logcat
33 /system/bin/logwrapper /system/bin/sshd -f /system/etc/ssh/sshd_config -D -d
35 # don't daemonize - otherwise we can't stop the sshd service
36 /system/bin/sshd -f /system/etc/ssh/sshd_config -D