pythonのparamikoで踏み台サーバへアクセスし、そこから別ホストへアクセスする方法を探しています。
以下のコマンドを実施しても、client.close()までは実施してプロンプトが戻ってくるには来るのですが処理結果が出力されません。
恐らく別ホストへもアクセスできていないと思われるのですが
対処する方法はないでしょうか。
client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.WarningPolicy()) client.connect('***.***.***.***', username='hostname', password='pass') stdin, stdout, stderr = client.exec_command('telnet ホスト名') stdin, stdout, stderr = client.exec_command('ID') stdin, stdout, stderr = client.exec_command('pass') stdin, stdout, stderr = client.exec_command('show clock等のコマンド') for result in stdout: print(result) client.close()
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2019/05/08 06:47