September 2018
Intermediate to advanced
426 pages
10h 46m
English
We can use the Paramiko module to create an SSH client and then connect it to the SSH server. This module will supply the SSHClient() class, which provides an interface to initiate server connections in a secure way. These instructions will create a new SSHClient instance, and connect to the SSH server by calling the connect() method:
import paramikossh_client = paramiko.SSHClient()ssh_client.connect(‘host’,username='username', password='password')
By default, the SSHClient instance of this client class will refuse to connect a host that does not have a key saved in our known_hosts file. With the AutoAddPolicy() class, you can set up a policy for accepting unknown host keys. Now, you need to run the ...