diff --git a/packages/network/openssh/init.d/51_sshd b/packages/network/openssh/init.d/51_sshd index dcfbe2449b..f97a02e92e 100644 --- a/packages/network/openssh/init.d/51_sshd +++ b/packages/network/openssh/init.d/51_sshd @@ -22,61 +22,55 @@ # # runlevels: openelec, textmode - RSA1_KEY="/storage/.cache/ssh/ssh_host_key" - RSA2_KEY="/storage/.cache/ssh/ssh_host_rsa_key" - DSA2_KEY="/storage/.cache/ssh/ssh_host_dsa_key" +( + RSA1_KEY="/storage/.cache/ssh/ssh_host_key" + RSA2_KEY="/storage/.cache/ssh/ssh_host_rsa_key" + DSA2_KEY="/storage/.cache/ssh/ssh_host_dsa_key" - KEYGEN="/usr/bin/ssh-keygen" - SSHD="/usr/sbin/sshd" + KEYGEN="/usr/bin/ssh-keygen" + SSHD="/usr/sbin/sshd" -case $RUNLEVEL in - boot) - ( - # Check for the SSH1 RSA key - if [ ! -f $RSA1_KEY ] ; then - progress "SSH: generating SSH1 RSA key" + # Check for the SSH1 RSA key + if [ ! -f $RSA1_KEY ] ; then + progress "SSH: generating SSH1 RSA key" - mkdir -p /storage/.cache/ssh - $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null - chmod 600 $RSA1_KEY - fi + mkdir -p /storage/.cache/ssh + $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null + chmod 600 $RSA1_KEY + fi - # Check for the SSH2 RSA key - if [ ! -f $RSA2_KEY ] ; then - progress "SSH: generating SSH2 RSA key" + # Check for the SSH2 RSA key + if [ ! -f $RSA2_KEY ] ; then + progress "SSH: generating SSH2 RSA key" - mkdir -p /storage/.cache/ssh - $KEYGEN -q -t rsa -f $RSA2_KEY -C '' -N '' >&/dev/null - chmod 600 $RSA2_KEY - fi + mkdir -p /storage/.cache/ssh + $KEYGEN -q -t rsa -f $RSA2_KEY -C '' -N '' >&/dev/null + chmod 600 $RSA2_KEY + fi - # Check for the SSH2 DSA key - if [ ! -f $DSA2_KEY ] ; then - progress "SSH: generating SSH2 DSA key" + # Check for the SSH2 DSA key + if [ ! -f $DSA2_KEY ] ; then + progress "SSH: generating SSH2 DSA key" - mkdir -p /storage/.cache/ssh - $KEYGEN -q -t dsa -f $DSA2_KEY -C '' -N '' >&/dev/null - chmod 600 $DSA2_KEY - fi + mkdir -p /storage/.cache/ssh + $KEYGEN -q -t dsa -f $DSA2_KEY -C '' -N '' >&/dev/null + chmod 600 $DSA2_KEY + fi - # Check for predifined known hosts file - if [ -f /etc/ssh/known_hosts -a ! -f $HOME/.ssh/known_hosts ] ; then - progress "SSH: setup predifined known hosts" + # Check for predifined known hosts file + if [ -f /etc/ssh/known_hosts -a ! -f $HOME/.ssh/known_hosts ] ; then + progress "SSH: setup predifined known hosts" - mkdir -p /$HOME/.ssh - cp /etc/ssh/known_hosts $HOME/.ssh - fi + mkdir -p /$HOME/.ssh + cp /etc/ssh/known_hosts $HOME/.ssh + fi - progress "Starting SSH Server" + progress "Starting SSH Server" - wait_for_network + wait_for_network - mkdir -p /var/empty - chmod -R 600 /var/empty - $SSHD - )& - ;; + mkdir -p /var/empty + chmod -R 600 /var/empty + $SSHD - poweroff|reboot) - ;; -esac +)&