Skip to content

Commit cbdc3bc

Browse files
authored
[UX] Avoid known hosts check (skypilot-org#1614)
* revert error raising as well * Avoid known hosts check * address comments
1 parent 8e9d0b2 commit cbdc3bc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sky/backends/backend_utils.py

+8
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,12 @@ def _get_generated_config(cls, autogen_comment: str, host_name: str,
371371
proxy = f'ProxyCommand {proxy_command}'
372372
else:
373373
proxy = ''
374+
# StrictHostKeyChecking=no skips the host key check for the first
375+
# time. UserKnownHostsFile=/dev/null and GlobalKnownHostsFile/dev/null
376+
# prevent the host key from being added to the known_hosts file and
377+
# always return an empty file for known hosts, making the ssh think
378+
# this is a first-time connection, and thus skipping the host key
379+
# check.
374380
codegen = textwrap.dedent(f"""\
375381
{autogen_comment}
376382
Host {host_name}
@@ -380,6 +386,8 @@ def _get_generated_config(cls, autogen_comment: str, host_name: str,
380386
IdentitiesOnly yes
381387
ForwardAgent yes
382388
StrictHostKeyChecking no
389+
UserKnownHostsFile=/dev/null
390+
GlobalKnownHostsFile=/dev/null
383391
Port 22
384392
{proxy}
385393
""".rstrip())

0 commit comments

Comments
 (0)