From: Shannon Sterz <s.sterz@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH cluster v2 1/2] cluster: setup: keep file permissions for sshd config
Date: Thu, 19 Nov 2026 12:23:17 +0100 [thread overview]
Message-ID: <20261119112318.118471-2-s.sterz@proxmox.com> (raw)
In-Reply-To: <20261119112318.118471-1-s.sterz@proxmox.com>
certain users may want to set stricter permissions than
`file_set_contents`'s 0644 default permissions. this change keeps
those permissions when modifying the file.
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/PVE/Cluster/Setup.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/PVE/Cluster/Setup.pm b/src/PVE/Cluster/Setup.pm
index 8a398d3..2550f70 100644
--- a/src/PVE/Cluster/Setup.pm
+++ b/src/PVE/Cluster/Setup.pm
@@ -157,7 +157,8 @@ sub setup_sshd_config {
$conf .= "\nPermitRootLogin yes\n";
}
- PVE::Tools::file_set_contents($ssh_system_server_config, $conf);
+ my $mode = (stat($ssh_system_server_config))[2] & 07777;
+ PVE::Tools::file_set_contents($ssh_system_server_config, $conf, $mode);
PVE::Tools::run_command(['systemctl', 'reload-or-restart', 'sshd']);
}
--
2.47.3
next prev parent reply other threads:[~2026-11-19 11:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 11:23 [PATCH cluster v2 0/2] Refine setup_sshd_config() Shannon Sterz
2026-11-19 11:23 ` Shannon Sterz [this message]
2026-11-19 11:23 ` [PATCH cluster v2 2/2] cluster: setup: match PermitRootLogin option more precisely Shannon Sterz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261119112318.118471-2-s.sterz@proxmox.com \
--to=s.sterz@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.