Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create connection with password? #1771

Closed
supriyopaul opened this issue May 21, 2018 · 4 comments
Closed

How to create connection with password? #1771

supriyopaul opened this issue May 21, 2018 · 4 comments

Comments

@supriyopaul
Copy link

This is when my public key is present on the server:

>>> c = Connection(host=ip, user='root', port=22)
>>> c.run('uname -s')
Linux
<Result cmd='uname -s' exited=0>

This is when my public key is removed from the server:

>>> c = Connection(host=ip, user='root', port=22)
>>> c.run('uname -s')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<decorator-gen-3>", line 2, in run
  File "/usr/local/lib/python2.7/dist-packages/fabric/connection.py", line 23, in opens
    self.open()
  File "/usr/local/lib/python2.7/dist-packages/fabric/connection.py", line 488, in open
    self.client.connect(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/paramiko/client.py", line 424, in connect
    passphrase,
  File "/usr/local/lib/python2.7/dist-packages/paramiko/client.py", line 691, in _auth
    self._transport.auth_publickey(username, key))
  File "/usr/local/lib/python2.7/dist-packages/paramiko/transport.py", line 1450, in auth_publickey
    return self.auth_handler.wait_for_response(my_event)
  File "/usr/local/lib/python2.7/dist-packages/paramiko/auth_handler.py", line 212, in wait_for_response
    raise e
AttributeError: '_RSAPrivateKey' object has no attribute 'sign'

How to pass password to Connection? P.S.: I could not find it in the new doccumentation(2.0).

@Goooooose7
Copy link

Connection(host="root@1.1.1.1", connect_kwargs={"password": "111111"})

@Monamounika
Copy link

I've almost 50 servers with the same username and password the how can i do it? each and every server and password i can't type. I would like to know how to do it?

@gamba47
Copy link

gamba47 commented Apr 23, 2019

I've almost 50 servers with the same username and password the how can i do it? each and every server and password i can't type. I would like to know how to do it?

The best way is to use ssh keys.

If you need to solve this you can add to your fabfile.py this lines before the task:

env.user = "username"
env.password = "bestpasswordever"

Best regards.

@Monamounika
Copy link

tried but got the following exception :[server] Executing task 'uptime'
[server] run: ps -ef|grep httpd | wc-l
c:\users\tmou\appdata\local\programs\python\python37-32\lib\site-packages\paramiko\ecdsakey.py:164: CryptographyDeprecationWarning: Support for unsafe construction of public
numbers from encoded data will be removed in a future version. Please use EllipticCurvePublicKey.from_encoded_point
self.ecdsa_curve.curve_class(), pointinfo

Fatal error: Timed out trying to connect to c4t18815.itcs.hpe.com (tried 1 time)

Underlying exception:
timed out

Aborting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants