jumphost를 통해 원격 시스템으로 ssh를 보내야합니다.paramiko를 사용하여 ssh-agent를 여러 홉으로 추가하는 방법
내가 같이 할 SSH를 사용하여 : 난 그냥 몇 가지 명령을 실행하려면 SSH -A -t 사용자 @ jumphost ssh를 -A 사용자 @의 vm_to_login
을, 내가 실행 SSH를 -A -t 사용자 @ 난 그냥 생각 ... 내가 위의 스크립트를 실행할 때
def ssh_connect(jumphost_ip):
ssh_client=paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
path_to_key=os.path.join(os.environ['HOME'], '.ssh', 'id_rsa')
ssh_client.connect(jumphost_ip, username='vagrant', key_filename=path_to_key, allow_agent=True)
return ssh_client
ssh_client = ssh_connect(host_ip)
stdin, stdout, stderr = ssh_client.exec_command("""ssh [email protected]_to_run_command -A "docker network inspect --format '{{json .Containers }}' bridge" """, get_pty=True)
, 프로그램이 무한 시간 걸려 : jumphost SSH -A 사용자 @의 vm_to_login는
지금 내가이 사용하는 파이썬을하고 시도 "명령을 실행합니다" SSHClient 객체는 키를 추가 할 수 없습니다. ssh 에이전트와 두 번째 서버가 키를 찾을 때 키 요청은 점프 박스로 이동하고 점프 박스에서 일부는 내 로컬로 이동하지만 SSHClient 객체에는 해당 키가 있습니다.
더 많은 정보가 필요하면 알려 주시기 바랍니다.