mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2026-01-09 08:55:31 +01:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user