Merge pull request #283 from stefansaraev/ssh

openssh: ensure that $HOME/.ssh exists, is root-owned and not world-readable
This commit is contained in:
Stephan Raue 2012-03-06 18:36:10 -08:00
commit 109e408769

View File

@ -29,6 +29,8 @@
KEYGEN="/usr/bin/ssh-keygen"
SSHD="/usr/sbin/sshd"
HOME="/storage"
(
if [ "$SSH" = yes -o -f /storage/.config/ssh_enable ]; then
@ -59,12 +61,16 @@
chmod 600 $DSA2_KEY
fi
# ensure that $HOME/.ssh exists, is root-owned and not world-readable
mkdir -p $HOME/.ssh
chown root:root $HOME/.ssh
chmod 0700 $HOME/.ssh
# Check for predefined known hosts file
if [ -f /etc/ssh/known_hosts -a ! -f $HOME/.ssh/known_hosts ] ; then
progress "SSH: setup predefined known hosts"
mkdir -p /$HOME/.ssh
cp /etc/ssh/known_hosts $HOME/.ssh
cp /etc/ssh/known_hosts $HOME/.ssh
fi
progress "Starting SSH Server"