From 7eb44f32a3b040fd0f52fecd4b4ef77e14d8d00a Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Tue, 8 Feb 2022 15:11:01 +0100 Subject: [PATCH] ssh-plugin-test: Copy SSH key manually instead of with ssh-copy-id ssh-copy-id requires password authentication that might be disabled on some cloud images. We can simply copy the key manually, because everything runs on localhost anyway. Fixes: #701 --- tests/ssh-plugin-test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/ssh-plugin-test b/tests/ssh-plugin-test index 40e42f43..bff29667 100755 --- a/tests/ssh-plugin-test +++ b/tests/ssh-plugin-test @@ -58,11 +58,11 @@ function bin_check() function ssh_setup() { - # .ssh is used by ssh-copy-id for temp files so it must exist even if key is not there - [ -d "$HOME/.ssh" ] || mkdir -m 700 $HOME/.ssh + # copy the ssh key + [ -d "/home/$USER/.ssh" ] || mkdir /home/$USER/.ssh + touch /home/$USER/.ssh/authorized_keys - # ssh-copy-id - sshpass -p $PASSWD ssh-copy-id -i $SSH_KEY_PATH $SSH_OPTIONS $USER@$SSH_SERVER >/dev/null 2>&1 + cat $SSH_KEY_PATH.pub >> /home/$USER/.ssh/authorized_keys [ $? -ne 0 ] && remove_user && skip "Failed to copy SSH key." # make sure /home/sshtest/.ssh and /home/sshtest/.ssh/authorized_keys have correct permissions