python ssh library

Solutions on MaxInterview for python ssh library by the best coders in the world

showing results for - "python ssh library"
Roberto
19 Aug 2016
1#ssh client in python example
2pip install paramiko
3
4client = paramiko.SSHClient()
5client.load_system_host_keys()
6client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
7client.connect(server,port,username,password)
8dir = directory
9command = command
10#change directory to the location of where you want to run the command and 
11#change command to the command you want to execute
12client.exec_command(f'cd {dir}; {command}')
13client.close()