File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -282,6 +282,7 @@ if [[ -n ${ssh_private_key_file-} ]]; then
282
282
fi
283
283
284
284
ssh_settings=$( ssh " ${ssh_args[@]} " -G " ${ssh_connection} " )
285
+ ssh_user=$( echo " $ssh_settings " | awk ' /^user / { print $2 }' )
285
286
ssh_host=$( echo " $ssh_settings " | awk ' /^hostname / { print $2 }' )
286
287
ssh_port=$( echo " $ssh_settings " | awk ' /^port / { print $2 }' )
287
288
411
412
# waiting for machine to become available again
412
413
until ssh_ -o ConnectTimeout=10 -- exit 0; do sleep 5; done
413
414
fi
415
+
416
+ # Installation will fail if non-root user is used for installer.
417
+ # Switch to root user by copying authorized_keys.
418
+ if [[ ${is_installer-n} == " y" ]] && [[ ${ssh_user} != " root" ]]; then
419
+ ssh_ " ${maybe_sudo} mkdir -p /root/.ssh; ${maybe_sudo} cp ~/.ssh/authorized_keys /root/.ssh"
420
+ ssh_connection=" root@${ssh_host} "
421
+ fi
422
+
414
423
for path in " ${! disk_encryption_keys[@]} " ; do
415
424
step " Uploading ${disk_encryption_keys[$path]} to $path "
416
425
ssh_ " umask 077; cat > $path " < " ${disk_encryption_keys[$path]} "
You can’t perform that action at this time.
0 commit comments