diff --git a/foodoor-update-keydb b/foodoor-update-keydb index f0c3b6c..a0a8c38 100755 --- a/foodoor-update-keydb +++ b/foodoor-update-keydb @@ -58,18 +58,26 @@ do outfile="${dest}/authorized_keys.${appendix}" cat ${temp_outfile} |envsubst > ${outfile} - # Oben - install -d -o ${appendix} -g nogroup -m 0700 /var/lib/foodoor/${appendix}/.ssh - install -b -S .last -o ${appendix} -g nogroup -m 0600 ${outfile} /var/lib/foodoor/${appendix}/.ssh/authorized_keys - + # Oben + if [ "$(hostname)" = "foodoor" ]; then + install -d -o ${appendix} -g nogroup -m 0700 /var/lib/foodoor/${appendix}/.ssh + install -b -S .last -o ${appendix} -g nogroup -m 0600 ${outfile} /var/lib/foodoor/${appendix}/.ssh/authorized_keys + fi # Unten - #if [ "${action}" = "open" ]; then - # owner="unlock" - #elif [ "${action}" = "close" ]; then - # owner="lock" - #fi + if [ "$(hostname)" = "kellertuer" ]; then + if [ "${action}" = "open" ]; then + owner="unlock" + elif [ "${action}" = "close" ]; then + owner="lock" + fi + install -d -o ${owner} -g nogroup -m 0700 /var/lib/foodoor/${action}/.ssh + install -b -S .last -o ${owner} -g nogroup -m 0600 ${outfile} /var/lib/foodoor/${action}/.ssh/authorized_keys + if [ "${appendix}" = "door" ]; then + install -d -o ${appendix} -g nogroup -m 0700 /var/lib/foodoor/${appendix}/.ssh + install -b -S .last -o ${appendix} -g nogroup -m 0600 ${outfile} /var/lib/foodoor/${appendix}/.ssh/authorized_keys + fi + + fi - #install -d -o ${owner} -g nogroup -m 0700 /var/lib/foodoor/${action}/.ssh - #install -b -S .last -o ${owner} -g nogroup -m 0600 ${outfile} /var/lib/foodoor/${action}/.ssh/authorized_keys done