OSDN Git Service

Add support for default authorized_keys file
authorMike Lockwood <lockwood@google.com>
Wed, 4 Jan 2012 15:38:46 +0000 (10:38 -0500)
committerMike Lockwood <lockwood@google.com>
Wed, 4 Jan 2012 15:38:46 +0000 (10:38 -0500)
Change-Id: I23c9f3a1aebaac090db21f55a0ba792a2412206b
Signed-off-by: Mike Lockwood <lockwood@google.com>
start-ssh

index d3a683c..b9d7218 100755 (executable)
--- a/start-ssh
+++ b/start-ssh
@@ -6,6 +6,8 @@ DSA_KEY=/data/ssh/ssh_host_dsa_key
 DSA_PUB_KEY=/data/ssh/ssh_host_dsa_key.pub
 RSA_KEY=/data/ssh/ssh_host_rsa_key
 RSA_PUB_KEY=/data/ssh/ssh_host_rsa_key.pub
+AUTHORIZED_KEYS=/data/ssh/authorized_keys
+DEFAULT_AUTHORIZED_KEYS=/system/etc/security/authorized_keys.default
 
 if [ ! -f $DSA_KEY ]; then
     ssh-keygen -t dsa -f $DSA_KEY -N ""
@@ -19,6 +21,10 @@ if [ ! -f $RSA_KEY ]; then
     chmod 644 $RSA_PUB_KEY
 fi
 
+if [[ ! -f $AUTHORIZED_KEYS && -f $DEFAULT_AUTHORIZED_KEYS ]]; then
+    cat $DEFAULT_AUTHORIZED_KEYS > $AUTHORIZED_KEYS
+fi
+
 
 if [ "1" == "$DEBUG" ] ; then
     # run sshd in debug mode and capture output to logcat