(self, pubkey, homedir, uid=None, gid=None)
Add a given SSH public key to the root user's authorized keys.
Add a given SSH public key to the root user's authorized keys.
Add a given SSH public key to the root user s authorized keys .
def add_ssh_pubkey_to_authorized_keys(self, pubkey, homedir, uid=None, gid=None):
        """ Add a given SSH public key to the root user's authorized keys. """
        logger.info("Adding {} to machine's authorized keys in home directory {}."
                    .format(pubkey, homedir))
        ssh_dir = '{}/.ssh'.format(homedir)
        authorized_keys_file = '{}/authorized_keys'.format(ssh_dir)
        self.run(['mkdir', '-p', ssh_dir])
        self.lxd_container.files.put(authorized_keys_file, pubkey, uid=uid, gid=gid)
def add_ssh_pubkey_to_authorized_keys ( self , pubkey , homedir , uid = None , gid = None ) : logger . info ( "Adding {} to machine's authorized keys in home directory {}." . format ( pubkey , homedir ) ) ssh_dir = '{}/.ssh' . format ( homedir ) authorized_keys_file = '{}/authorized_keys' . format ( ssh_dir ) self . run ( [ 'mkdir' , '-p' , ssh_dir ] ) self . lxd_container . files . put ( authorized_keys_file , pubkey , uid = uid , gid = gid )