Finally, I found that the problem is with generating a pair of public and private keys.
I followed the steps described in the windows azure guide , where the keys are generated using openssl, so the result of the process opens the public key stored in the pem file, which you must load into your instance during the creation process.
The problem is that the received private key is not recognized correctly by paramiko, so the fabric will not work. If you try to open an ssh connection using paramiko from the python interpreter:
>>> import paramiko, os >>> paramiko.common.logging.basicConfig(level=paramiko.common.DEBUG) >>> ssh = paramiko.SSHClient() >>> ssh.load_host_keys('private_key_file.key')
Gives me an error:
DEBUG:paramiko.transport:Trying SSH agent key a9d8dd41609191ebeedbe8df768ad8c9 DEBUG:paramiko.transport:userauth is OK INFO:paramiko.transport:Authentication (publickey) failed. Traceback (most recent call last): File "<stdin>", line 1, in <module> File ".. /paramiko/client.py", line 337, in connect self._auth(username, password, pkey, key_filenames, allow_agent, look_for_keys) File ".. /paramiko/client.py", line 528, in _auth raise saved_exception paramiko.PasswordRequiredException: Private key file is encrypted
If the key file is not encrypted.
To solve this problem, I created a key pair using openssh and then convert the public key to pem to load it into azure:
# Create key with openssh ssh-keygen -t rsa -b 2048 -f private_key_file.key # extract public key and store as x.509 pem format openssl req -x509 -days 365 -new -key private_key_file.key -out public_key_file.pem # upload public_key_file.pem file during instance creation # check connection to instance ssh -i private_key_file.key -p 63534 adminweb@host.cloudapp.net
This solved the problem.
kothvandir
source share