github.com/pingcap/chaos@v0.0.0-20190710112158-c86faf4b3719/docker/node/run.sh (about) 1 #!/bin/bash 2 3 if [ "${AUTHORIZED_KEYS}" != "**None**" ]; then 4 echo "=> Found authorized keys" 5 mkdir -p /root/.ssh 6 chmod 700 /root/.ssh 7 touch /root/.ssh/authorized_keys 8 chmod 600 /root/.ssh/authorized_keys 9 IFS=$'\n' 10 arr=$(echo ${AUTHORIZED_KEYS} | tr "," "\n") 11 for x in $arr 12 do 13 x=$(echo $x |sed -e 's/^ *//' -e 's/ *$//') 14 cat /root/.ssh/authorized_keys | grep "$x" >/dev/null 2>&1 15 if [ $? -ne 0 ]; then 16 echo "=> Adding public key to /root/.ssh/authorized_keys: $x" 17 echo "$x" >> /root/.ssh/authorized_keys 18 fi 19 done 20 fi 21 22 exec /usr/sbin/sshd -D