From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 2771579233 for ; Tue, 4 May 2021 09:52:36 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1DE282440B for ; Tue, 4 May 2021 09:52:36 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id A393524402 for ; Tue, 4 May 2021 09:52:35 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 6E43F42112 for ; Tue, 4 May 2021 09:52:35 +0200 (CEST) From: Wolfgang Bumiller To: pbs-devel@lists.proxmox.com Date: Tue, 4 May 2021 09:52:34 +0200 Message-Id: <20210504075234.7790-1-w.bumiller@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.020 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [tools.rs] Subject: [pbs-devel] [PATCH backup] fix permissions set in create_run_dir X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 07:52:36 -0000 This directory needs to be owned by the backup user instead of root. Signed-off-by: Wolfgang Bumiller --- src/tools.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tools.rs b/src/tools.rs index 25323881..c58569a6 100644 --- a/src/tools.rs +++ b/src/tools.rs @@ -16,6 +16,7 @@ use openssl::hash::{hash, DigestBytes, MessageDigest}; use percent_encoding::{utf8_percent_encode, AsciiSet}; pub use proxmox::tools::fd::Fd; +use proxmox::tools::fs::{create_path, CreateOptions}; pub mod acl; pub mod apt; @@ -569,7 +570,11 @@ pub fn compute_file_csum(file: &mut File) -> Result<([u8; 32], u64), Error> { /// This exists to fixate the permissions for the run *base* directory while allowing intermediate /// directories after it to have different permissions. pub fn create_run_dir() -> Result<(), Error> { - let _: bool = proxmox::tools::fs::create_path(PROXMOX_BACKUP_RUN_DIR_M!(), None, None)?; + let backup_user = crate::backup::backup_user()?; + let opts = CreateOptions::new() + .owner(backup_user.uid) + .group(backup_user.gid); + let _: bool = create_path(PROXMOX_BACKUP_RUN_DIR_M!(), None, Some(opts))?; Ok(()) } -- 2.20.1