From b2327c0c5a4816fd1d34d9f8f442175c8904e784 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 15 Nov 2023 15:33:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B4=A6=E5=8F=B7=E6=94=B9=E5=AF=86=20r?= =?UTF-8?q?oot=E5=AF=86=E9=92=A5=E6=97=A0=E6=B3=95=E6=9B=BF=E6=8D=A2=20(#1?= =?UTF-8?q?2121)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/automations/change_secret/manager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/accounts/automations/change_secret/manager.py b/apps/accounts/automations/change_secret/manager.py index c9939f647..adc840c3f 100644 --- a/apps/accounts/automations/change_secret/manager.py +++ b/apps/accounts/automations/change_secret/manager.py @@ -49,7 +49,9 @@ class ChangeSecretManager(AccountBasePlaybookManager): kwargs['exclusive'] = 'yes' if kwargs['strategy'] == SSHKeyStrategy.set else 'no' if kwargs['strategy'] == SSHKeyStrategy.set_jms: - kwargs['dest'] = '/home/{}/.ssh/authorized_keys'.format(account.username) + username = account.username + path = f'/{username}' if username == "root" else f'/home/{username}' + kwargs['dest'] = f'{path}/.ssh/authorized_keys' kwargs['regexp'] = '.*{}$'.format(secret.split()[2].strip()) return kwargs