diff --git a/paramiko_tutorial/client.py b/paramiko_tutorial/client.py index dc2d840..c868269 100644 --- a/paramiko_tutorial/client.py +++ b/paramiko_tutorial/client.py @@ -1,5 +1,6 @@ """Client to handle connections and actions executed against a remote host.""" from os import system +import subprocess as sp from typing import List from paramiko import AutoAddPolicy, RSAKey, SSHClient @@ -65,7 +66,7 @@ def _get_ssh_key(self): def _upload_ssh_key(self): try: - system( + sp.getoutput( f"ssh-copy-id -i {self.ssh_key_filepath}.pub {self.user}@{self.host}>/dev/null 2>&1" ) LOGGER.info(f"{self.ssh_key_filepath} uploaded to {self.host}")