github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/tests/tiup/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; do
    12  		x=$(echo $x | sed -e 's/^ *//' -e 's/ *$//')
    13  		cat /root/.ssh/authorized_keys | grep "$x" >/dev/null 2>&1
    14  		if [ $? -ne 0 ]; then
    15  			echo "=> Adding public key to /root/.ssh/authorized_keys: $x"
    16  			echo "$x" >>/root/.ssh/authorized_keys
    17  		fi
    18  	done
    19  fi
    20  
    21  # exec /usr/sbin/sshd -D
    22  exec /bin/systemd