From 673c7a3858eba4a47ea9039a3f1a7fab0efb7cc4 Mon Sep 17 00:00:00 2001 From: Mathieu Broillet Date: Mon, 19 Jun 2023 09:58:29 +0200 Subject: [PATCH] fixed problem with running scripts and ssh key generation on new lxc --- protected_resources/scripts/install-config-ssh.sh | 3 +++ src/lxc/lxc.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/protected_resources/scripts/install-config-ssh.sh b/protected_resources/scripts/install-config-ssh.sh index 9ffcccf..a40f678 100644 --- a/protected_resources/scripts/install-config-ssh.sh +++ b/protected_resources/scripts/install-config-ssh.sh @@ -61,3 +61,6 @@ fi # Set PermitRootLogin to prohibit-password sed -i 's/^#*PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config + +# Generate SSH keys (doesn't overwrite if keys already exists) +ssh-keygen -q -t rsa -N '' <<< $'\nn' >/dev/null 2>&1 \ No newline at end of file diff --git a/src/lxc/lxc.py b/src/lxc/lxc.py index e30a0dc..a9a9dd1 100644 --- a/src/lxc/lxc.py +++ b/src/lxc/lxc.py @@ -362,7 +362,7 @@ class LXC(LinuxMachine): :param script_path: :return: """ - return self.run_command(command=f"chmod +x {script_path} && bash {script_path}") + return self.run_command(command=f"bash {script_path}") def run_command(self, command: str, return_status_code: bool = False, exception_on_exit: bool = False,