Код: Выделить всё
2024-10-21 12:43:02,818 - my_script - INFO - Executing "scp /path/to/myfile user@remote_host:/path/to/destination"...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:3sBR/FJGaj4PQ7stELZerU7MXoLRqKwkGnnlfEXTSEo.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ED25519 key in /root/.ssh/known_hosts:11
remove with:
ssh-keygen -f "/root/.ssh/known_hosts" -R "remote_host"
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
UpdateHostkeys is disabled because the host key is not trusted.
user@remote_host: Permission denied (publickey,password).
lost connection
2024-10-21 12:43:12,913 - my_script - ERROR - Could not upload "/path/to/myfile" to remote server: "Command '['scp', '/path/to/myfile', 'user@remote_host:/path/to/destination']' returned non-zero exit status 1."
Как я могу эффективно устранить эту проблему и/или предотвратить случайное появление этого предупреждения?
Вот код Python, используемый для выполнения команды SCP:
Код: Выделить всё
def upload(config: dict, file: str):
scp_cmd = ['scp', file, config['server_files_folder']]
scp_str = ' '.join(scp_cmd)
logger.info(f'Executing "{scp_str}"...')
try:
check_output(scp_cmd)
logger.info(f'"{file}" successfully uploaded to tileserver!')
except CalledProcessError as e:
logger.error(f'Could not upload "{file}" to server: "{e}"')
logger.error('Leaving the program...')
exit(1)
Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/791 ... as-changed