I want to connect to putty and want to do few step:
I need to write the code in windows. But my server is in linux. How shall I proceed? Thanks in advance
What you need is Paramiko, but it may be a little complicated for a beginner.
For simple, repetitive tasks you may use my script - it is located on GitHub (https://github.com/tadeck/ssh-matic) and was created to learn some Python. It is based on someone else's friendly SSH Python interface to Paramiko (code accessible here).
Using the mentioned SSH module connecting to server and executing a command is rather simple:
import ssh
server = ssh.Connection(host='host', username='user', private_key='key_path')
result = server.execute('your command')
Basically what you need is not PuTTy, but a SSH module to Python. This module should work both on Windows and Linux. Using my script you will only need to work on the command you want to invoke, plus adjust the code to your needs.
Good luck. Tell me if it helped.
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