@@ -246,18 +246,18 @@ def set_token(hostname, username, password, pvtkey):
246246@sshbot .command ()
247247@click .option ('--ssh_folder' , default = None , help = 'path where the key pair will be saved, by default None (the `USER/.ssh` folder will be used)' )
248248@click .option ('--password' , default = None , help = 'encrypt the private key with a password' )
249- def genkeys (ssh_folder ):
249+ def genkeys (ssh_folder , password ):
250250 """Create a set of public and private keys and save them in the given folder.
251251 """
252- out = gen_keypair (ssh_folder )
252+ out = gen_keypair (ssh_folder , password )
253253 click .echo (out )
254254
255255
256256@sshbot .command ()
257257@click .argument ('hostname' )
258258@click .argument ('username' )
259259@click .argument ('password' )
260- @click .option ('--ssh_folder' , help = 'path where the key pair will be saved' )
260+ @click .option ('--ssh_folder' , default = None , help = 'path where the key pair will be saved' )
261261def link_keys (hostname , username , password , ssh_folder ):
262262 """Adds the public key to the server's list.\n
263263
@@ -271,6 +271,8 @@ def link_keys(hostname, username, password, ssh_folder):
271271 password on the server, by default empty.\n
272272 """
273273 bot = sshBot (config_file = None , hostname = hostname , username = username , password = password , pvtkey = "" )
274+ if not ssh_folder :
275+ ssh_folder = os .path .join (str (Path .home ()), '.ssh' )
274276 out = add_pubkey_to_server (bot , ssh_folder )
275277 click .echo (out )
276278 out = add_token ("ssh" , hostname = hostname , username = username , password = "" , pvtkey = os .path .join (ssh_folder , 'id_rsa' ))
0 commit comments