D
DHR
I'm trying to run the simpliest example form paramiko readme(Homepage:
http://www.lag.net/paramiko/), and
cannot find out how to get the remote SSH server host_key.
This is the code. It is supposed to connect to a remote SSH host and
execute an 'ls' command:
import paramiko, base64
key = paramiko.RSAKey(data=base64.decodestring('AAA...'))
client = paramiko.SSHClient()
client.get_host_keys().add('ssh.example.com', 'ssh-rsa', key)
client.connect('227.112.168.273', username='uname', password='pass')
stdin, stdout, stderr = client.exec_command('ls')
for line in stdout:
print '... ' + line.strip('\n')
client.close()
Now, if I understand it correctly I need to get somehow the host_key
from the server and
write it insted of the 'AAA...' thing. Is there a command to get the
host_key from a remote SSH
server?
http://www.lag.net/paramiko/), and
cannot find out how to get the remote SSH server host_key.
This is the code. It is supposed to connect to a remote SSH host and
execute an 'ls' command:
import paramiko, base64
key = paramiko.RSAKey(data=base64.decodestring('AAA...'))
client = paramiko.SSHClient()
client.get_host_keys().add('ssh.example.com', 'ssh-rsa', key)
client.connect('227.112.168.273', username='uname', password='pass')
stdin, stdout, stderr = client.exec_command('ls')
for line in stdout:
print '... ' + line.strip('\n')
client.close()
Now, if I understand it correctly I need to get somehow the host_key
from the server and
write it insted of the 'AAA...' thing. Is there a command to get the
host_key from a remote SSH
server?