aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/xds-docker-create-container.sh
diff options
context:
space:
mode:
authorbrian avery <brian.avery@intel.com>2017-11-10 13:15:12 -0800
committerbrian avery <brian.avery@intel.com>2017-11-10 13:15:12 -0800
commit4668cb0fe680bb43dbbbce661c2c53c9762c0546 (patch)
tree5276faf126f51ed7b681546fab86b0b9058acfb7 /scripts/xds-docker-create-container.sh
parent1e0b1b4c1271e3668ec5ef1ba58cb84fe00f0f53 (diff)
Fix case where ~/.ssh/id_rsa.pub is a softlink
Some users may have the default id_rsa/id_rsa.pub be a softlink to one of a set of rsa keys. In this case, the cp would result in a dangling softlink in the container and the startup fails. Adding a -L to the cp command results in copying whatever the softlink points to into the container, which seems like the desired behaviour. Signed-off-by: brian avery <brian.avery@intel.com>
Diffstat (limited to 'scripts/xds-docker-create-container.sh')
-rwxr-xr-xscripts/xds-docker-create-container.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/xds-docker-create-container.sh b/scripts/xds-docker-create-container.sh
index 88c74eb..3f5fe5f 100755
--- a/scripts/xds-docker-create-container.sh
+++ b/scripts/xds-docker-create-container.sh
@@ -174,7 +174,7 @@ echo
[ -f ~/.ssh/known_hosts ] && { ssh-keygen -R "[localhost]:$SSH_PORT" -f ~/.ssh/known_hosts || exit 1; }
[ ! -f ~/.ssh/id_rsa.pub ] && { ssh-keygen -t rsa -f ~/.ssh/id_rsa -P "" > /dev/null || exit 1; }
docker exec ${NAME} bash -c "mkdir -p /home/$DOCKER_USER/.ssh" || exit 1
-docker cp ~/.ssh/id_rsa.pub ${NAME}:/home/$DOCKER_USER/.ssh/authorized_keys || exit 1
+docker cp -L ~/.ssh/id_rsa.pub ${NAME}:/home/$DOCKER_USER/.ssh/authorized_keys || exit 1
docker exec ${NAME} bash -c "chown $DOCKER_USER:$DOCKER_USER -R /home/$DOCKER_USER/.ssh ;chmod 0700 /home/$DOCKER_USER/.ssh; chmod 0600 /home/$DOCKER_USER/.ssh/*" || exit 1
ssh -n -o StrictHostKeyChecking=no -p $SSH_PORT $DOCKER_USER@localhost exit || exit 1