Last active
August 29, 2015 14:27
-
-
Save samuelsh/d545f34b0c461499c62f to your computer and use it in GitHub Desktop.
Method genetates id_rsa and id_rsa.pub on client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def RSA_keys_generator(complexity=2048): | |
""" | |
Method generates id_rsa and id_rsa.pub on client. Tested on CentOS 6.x clients | |
""" | |
import paramiko | |
k = paramiko.RSAKey.generate(complexity) | |
k.write_private_key_file(os.path.expanduser('~/.ssh/id_rsa')) | |
with open(os.path.expanduser('~/.ssh/id_rsa.pub'), "w") as f: | |
f.write("ssh-rsa " + k.get_base64()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment