mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-02-01 22:51:50 +00:00
feat: allow adding SSH authorized key for root (advanced settings) (#1060)
This commit is contained in:
parent
d9eb122650
commit
8816bced80
@ -568,6 +568,10 @@ advanced_settings() {
|
|||||||
echo -e "${ROOTSSH}${BOLD}${DGN}Root SSH Access: ${BGN}$SSH${CL}"
|
echo -e "${ROOTSSH}${BOLD}${DGN}Root SSH Access: ${BGN}$SSH${CL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "${SSH}" == "yes" ]]; then
|
||||||
|
SSH_AUTHORIZED_KEY="$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "SSH Authorized key for root (leave empty for none)" 8 58 --title "SSH Key" 3>&1 1>&2 2>&3)"
|
||||||
|
fi
|
||||||
|
|
||||||
if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then
|
if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then
|
||||||
VERB="yes"
|
VERB="yes"
|
||||||
else
|
else
|
||||||
@ -731,6 +735,7 @@ build_container() {
|
|||||||
export PASSWORD="$PW"
|
export PASSWORD="$PW"
|
||||||
export VERBOSE="$VERB"
|
export VERBOSE="$VERB"
|
||||||
export SSH_ROOT="${SSH}"
|
export SSH_ROOT="${SSH}"
|
||||||
|
export SSH_AUTHORIZED_KEY="${SSH_AUTHORIZED_KEY}"
|
||||||
export CTID="$CT_ID"
|
export CTID="$CT_ID"
|
||||||
export CTTYPE="$CT_TYPE"
|
export CTTYPE="$CT_TYPE"
|
||||||
export PCT_OSTYPE="$var_os"
|
export PCT_OSTYPE="$var_os"
|
||||||
|
@ -262,4 +262,11 @@ EOF
|
|||||||
fi
|
fi
|
||||||
echo "bash -c \"\$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/${app}.sh)\"" >/usr/bin/update
|
echo "bash -c \"\$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/${app}.sh)\"" >/usr/bin/update
|
||||||
chmod +x /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
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user