Skip to content

Commit 4535bd6

Browse files
rotupatrickelectric
authored andcommitted
Disable strict host key checking for scp
Prevents errors like: ``` 2025-01-24 22:26:11.566 | DEBUG | commonwealth.utils.commands:upload_file:137 - uploading to /boot/firmware/config.txt 2025-01-24 22:26:11.664 | DEBUG | commonwealth.utils.commands:upload_file:145 - CompletedProcess(args=['scp', '-i', '/root/.config/.ssh/id_rsa', '/tmp/file_to_upload', 'pi@localhost:/tmp/uploaded_file'], returncode=255, stdout='', stderr='ssh: connect to host localhost port 22: Connection refused\nscp: Connection closed\n') 2025-01-24 22:26:11.665 | ERROR | commonwealth.utils.commands:upload_file:149 - Failed to upload file: ssh: connect to host localhost port 22: Connection refused scp: Connection closed ```
1 parent eb401be commit 4535bd6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/libs/commonwealth/commonwealth/utils/commands.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ def upload_file_with_password(
9494
"-p",
9595
password,
9696
"scp",
97+
"-o",
98+
"StrictHostKeyChecking=no",
9799
source,
98100
f"{user}@localhost:{destination}",
99101
],
@@ -116,6 +118,8 @@ def upload_file_with_ssh_key(source: str, destination: str, check: bool = True)
116118
"scp",
117119
"-i",
118120
id_file,
121+
"-o",
122+
"StrictHostKeyChecking=no",
119123
source,
120124
f"{user}@localhost:{destination}",
121125
],

0 commit comments

Comments
 (0)