From 2ce7e3fabdb1789d21d8b33a113c1ca46f5480e4 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Sat, 11 Feb 2023 23:14:44 +0200 Subject: [PATCH] Fix env variables inherited by SSH --- clearml_session/interactive_session_task.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/clearml_session/interactive_session_task.py b/clearml_session/interactive_session_task.py index 395a424..847d616 100644 --- a/clearml_session/interactive_session_task.py +++ b/clearml_session/interactive_session_task.py @@ -460,6 +460,12 @@ def setup_ssh_server(hostname, hostnames, param, task, env): if not param.get("ssh_server"): return + # make sure we do not pass it along to others, work on a copy + env = deepcopy(env) + env.pop('LOCAL_PYTHON', None) + env.pop('PYTHONPATH', None) + env.pop('DEBIAN_FRONTEND', None) + print("Installing SSH Server on {} [{}]".format(hostname, hostnames)) ssh_password = param.get("ssh_password", "training") # noinspection PyBroadException @@ -601,8 +607,7 @@ def setup_ssh_server(hostname, hostnames, param, task, env): except Exception: pass proc_args = [sshd_path, "dropbear", "-e", "-K", "30", "-I", "0", "-F", "-p", str(port)] + dropbear_key_files - # make sure we do not pass it along to others, work on a copy - env = deepcopy(env) + # this is a copy oof `env` so there is nothing to worry about env["DROPBEAR_CLEARML_FIXED_PASSWORD"] = ssh_password else: proc_args = [sshd_path, "-D", "-p", str(port)] + (["-f", custom_ssh_conf] if custom_ssh_conf else [])