Commit 5ff5e665 authored by Michał 'rysiek' Woźniak's avatar Michał 'rysiek' Woźniak
Browse files

bugfix: handle KNOWNHOSTSDIR and SSHIDSDIR files only if they actually exist...

parent 4b368a51
......@@ -25,8 +25,10 @@ if [ ! -e /etc/ssh/ssh_known_hosts ]; then
# individual known hosts keys from $KNOWNHOSTSDIR
echo "+-- adding local host keys from $KNOWNHOSTSDIR, if any..."
for kh in "$KNOWNHOSTSDIR"/*; do
echo " +-- $kh"
echo -e "\n* $( cat "$kh" )" >> /etc/ssh/ssh_known_hosts
if [ -f "$kh" ]; then
echo " +-- $kh"
echo -e "\n* $( cat "$kh" )" >> /etc/ssh/ssh_known_hosts
fi
done
echo " +-- done."
# if SSH_KNOWN_HOSTS is nonempty, let's add that to ssh_known_hosts
......@@ -48,8 +50,10 @@ echo "+-- .ssh dir..."
# handle ssh id files, if any
echo "+-- copying SSH ID files from $SSHIDSDIR, if any"
for sshid in "$SSHIDSDIR"/*; do
echo " +-- $sshid..."
cp "$sshid" "${HOMEDIR}/.ssh/$( basename $sshid )"
if [ -f "$sshid" ]; then
echo " +-- $sshid..."
cp "$sshid" "${HOMEDIR}/.ssh/$( basename $sshid )"
fi
done
# do we have the keys? if not, create...
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment