diff --git a/IM/connectors/Docker.py b/IM/connectors/Docker.py index 83d8f4659..1625340e5 100644 --- a/IM/connectors/Docker.py +++ b/IM/connectors/Docker.py @@ -182,11 +182,7 @@ def _generate_create_svc_request_data(self, image_name, outports, vm, ssh_port, command += " ; " command += "mkdir /var/run/sshd" command += " ; " - command += " sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config " - command += " ; " - command += "sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config" - command += " ; " - command += "sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config" + command += "sed -i '/PermitRootLogin/c\PermitRootLogin yes' /etc/ssh/sshd_config" command += " ; " command += "rm -f /etc/ssh/ssh_host_rsa_key*" command += " ; " diff --git a/IM/connectors/Kubernetes.py b/IM/connectors/Kubernetes.py index c9a3cdf3d..ddab57cac 100644 --- a/IM/connectors/Kubernetes.py +++ b/IM/connectors/Kubernetes.py @@ -241,9 +241,7 @@ def _generate_pod_data(self, apiVersion, namespace, name, outports, system, ssh_ command += " ; " command += "mkdir /var/run/sshd" command += " ; " - command += "sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config" - command += " ; " - command += "sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config" + command += "sed -i '/PermitRootLogin/c\PermitRootLogin yes' /etc/ssh/sshd_config" command += " ; " command += "ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''" command += " ; "