diff --git a/misc/build.func b/misc/build.func index 4d29a3fe..9c7d6a93 100644 --- a/misc/build.func +++ b/misc/build.func @@ -827,6 +827,7 @@ build_container() { export PASSWORD="$PW" export VERBOSE="$VERB" export SSH_ROOT="${SSH}" + export SSH_AUTHORIZED_KEY export CTID="$CT_ID" export CTTYPE="$CT_TYPE" export PCT_OSTYPE="$var_os" diff --git a/misc/install.func b/misc/install.func index 1a3cf5eb..59d87566 100644 --- a/misc/install.func +++ b/misc/install.func @@ -255,4 +255,11 @@ EOF fi echo "bash -c \"\$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update + + if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then + mkdir -p /root/.ssh + echo "${SSH_AUTHORIZED_KEY}" > /root/.ssh/authorized_keys + chmod 700 /root/.ssh + chmod 600 /root/.ssh/authorized_keys + fi }