I'm trying to connect to a server via SSH by a Python script. Currently i'm trying out paramiko. I set up a public key between the client and the server so i don't need a password. I'm using the following code at the moment:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.56.102', 'oracle', None, '~/.ssh/id_rsa')
stdin, stdout, stderr = ssh.exec_command('ls')
But when running this I'm getting the error
[Errno -8] Servname not supported for ai_socktype
Any help?
You can just specify the parameters. Don't need to add the port number (if it's ok with the default one).
From the definition of connect, your example would look like this:
ssh.connect('192.168.56.102', username='oracle', password=None, key_filename='~/.ssh/id_rsa')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With