summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-11 23:35:40 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-11 23:35:40 +0200
commitd30e0b06ea6070a5805865354547805e6d5a8242 (patch)
tree5d8452b836ccf229a1c1587fffc01c9a8017f008
parentb7f6f6f2939048848590d43b1ebf175a52076a91 (diff)
downloadalpine-conf-d30e0b06ea6070a5805865354547805e6d5a8242.zip
setup-sshd: prefix sshd_config with $ROOT
So we can run tests
-rw-r--r--setup-sshd.in10
1 files changed, 5 insertions, 5 deletions
diff --git a/setup-sshd.in b/setup-sshd.in
index 8987226..18de60e 100644
--- a/setup-sshd.in
+++ b/setup-sshd.in
@@ -54,9 +54,9 @@ if [ "$sshdchoice" = "openssh" ] && [ -z "$authorized_key" ]; then
ask "Allow root ssh login? ('yes', 'no', 'prohibit-password' or KEYURL) [prohibit-password]" prohibit-password
case "$resp" in
yes|no|prohibit-password)
- sed -i -E -e "s/^#?\s*PermitRootLogin.*/PermitRootLogin $resp/" /etc/ssh/sshd_config
- if ! grep -q ^PermitRootLogin /etc/ssh/sshd_config; then
- echo "PermitRootLogin $resp" >> /etc/ssh/sshd_config
+ sed -i -E -e "s/^#?\s*PermitRootLogin.*/PermitRootLogin $resp/" "$ROOT"/etc/ssh/sshd_config
+ if ! grep -q ^PermitRootLogin "$ROOT"/etc/ssh/sshd_config; then
+ echo "PermitRootLogin $resp" >> "$ROOT"/etc/ssh/sshd_config
fi
break
;;
@@ -87,6 +87,6 @@ if [ -n "$authorized_key" -a "$authorized_key" != "none" ]; then
authorized_key="$($MOCK wget -qO- "$key_url")" || die "Failed to fetch key from '$key_url'"
;;
esac
- mkdir -p ${ROOT}/root/.ssh
- echo "$authorized_key" >> ${ROOT}/root/.ssh/authorized_keys
+ mkdir -p "$ROOT"/root/.ssh
+ echo "$authorized_key" >> "$ROOT"/root/.ssh/authorized_keys
fi