From 9d240652583b342c00fc2e47726f12c1a33bf7f9 Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Tue, 16 Aug 2022 00:09:23 +0200 Subject: [PATCH] ssh.py: fixups, use correct mode for .ssh dir --- ssh.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ssh.py b/ssh.py index ecdc780..c9787c8 100644 --- a/ssh.py +++ b/ssh.py @@ -112,12 +112,12 @@ def copy_ssh_keys(root_dir: str, user: str): ssh_dir = os.path.join(root_dir, 'home', user, '.ssh') if not os.path.exists(ssh_dir): - os.makedirs(ssh_dir, exist_ok=True) + os.makedirs(ssh_dir, exist_ok=True, mode=0o700) with open(authorized_keys_file, 'a') as authorized_keys: for key in keys: pub = f'{key}.pub' - if not os.path.exists('pub'): + if not os.path.exists(pub): logging.debug(f'Skipping key {key}: {pub} not found') continue with open(pub, 'r') as file: