diff --git a/VMAccess/vmaccess.py b/VMAccess/vmaccess.py index e4557f986..5d4fa321e 100644 --- a/VMAccess/vmaccess.py +++ b/VMAccess/vmaccess.py @@ -382,10 +382,12 @@ def _allow_password_auth(): _set_sshd_config(config, "PasswordAuthentication", "yes") ext_utils.replace_file_with_contents_atomic(SshdConfigPath, "\n".join(config)) - if isinstance(MyDistro, dist_utils.UbuntuDistro): #handle ubuntu 22.04 (sshd_config.d directory) + if isinstance(MyDistro, dist_utils.UbuntuDistro) or \ #handle ubuntu 22.04 (sshd_config.d directory) + isinstance(MyDistro, dist_utils.RedhatDistro) or \ + isinstance(MyDistro, dist_utils.CentOSDistro): cloudInitConfigPath = "/etc/ssh/sshd_config.d/50-cloud-init.conf" config = ext_utils.get_file_contents(cloudInitConfigPath) - if config is not None: #other versions of ubuntu don't contain this file + if config is not None: config = config.split("\n") _set_sshd_config(config, "PasswordAuthentication", "yes") ext_utils.replace_file_with_contents_atomic(cloudInitConfigPath, "\n".join(config))