public void associateCommand ( SshPublicKey key , String command ) throws SshException , PublicKeySubsystemException { try { Packet msg = createPacket ( ) ; msg . writeString ( "command" ) ; msg . writeString ( key . getAlgorithm ( ) ) ; msg . writeBinaryString ( key . getEncoded ( ) ) ; msg . writeString ( command ) ; sendMessage ( msg ) ; readStatusResponse ( ) ; } catch ( IOException ex ) { throw new SshException ( ex ) ; } }
Associate a command with an accepted public key . The request will fail if the public key is not currently in the users acceptable list . Also some server implementations may choose not to support this feature .