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).
Connection(host="[email protected]", connect_kwargs={"password": "111111"})
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?
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.
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.
Most helpful comment
Connection(host="[email protected]", connect_kwargs={"password": "111111"})