gdlm
gdlm

Reputation: 353

SSH connection with python

I'd like to make a python script that connect with an SSH server, but as I can't send password as an argv, how could I do that?

os.system("user@server password")

And if it fails, what would be the return?

Upvotes: 0

Views: 426

Answers (3)

zhangyangyu
zhangyangyu

Reputation: 8620

Use Paramiko:

client = paramiko.SSHClient()
client.connect('my.example.com', username='brandon', password=mypass)

Upvotes: 1

karthikr
karthikr

Reputation: 99680

You can use some 3rd libraries like fabric or Paramiko

Upvotes: 2

Mark Stanislav
Mark Stanislav

Reputation: 979

You should probably looking into doing this with a library or wrapper to make this work out properly and with more support. Here are some examples.

Upvotes: 2

Related Questions