In command or RPC protocols that are written with SSH as the transport medium, is there a standard seperating character that the SSH server uses to parse commands?

For example, if we have a simple protocol defined between a client and a server, where the client will open an SSH connection to the server and then start sending bytes:

DO COMMAND <something> DO C0MMAND2

is there a standard <something>? Or does each protocol over SSH "do it's own thing".

As an example of a standard, "Null-terminated strings are a C construct used to determine the end of a sequence of characters intended to be used as a string.": https://stackoverflow.com/questions/34621006/how-can-a-file-contain-null-bytes

If there is not a standard, are there custom parsers that need to be written for SSH servers depending on the "message format"?

My high level question is whether SSH frameworks know how to "split messages" based on some standard, or whether each SSH server for a protocol is written with a custom listener and has to know when a "full" message is received, wait for the next separating character, etc.

  • 1
    Do you have an example of such protocol over SSH? Are you possibly referring to ssh connection multiplexing? – Stéphane Chazelas Feb 27 at 15:28
  • Is this question about SCP (and the SSH subsystem mechanism in general)? – Toby Speight Feb 28 at 18:36

Secure shell is a means to use just that: a shell. As such, the syntax for command separation via SSH is identical to command separation locally:

$ echo foo; whoami; hostname
$ ssh myself@remote "echo foo; whoami; hostname"
  • programatically, what is the "control character" equivelent to a user pressing enter on the keyboard? Is it \n? Meaning, if you were doing the same thing but from a programatic client, does inserting "\n" trigger this same behavior? – Tommy Feb 28 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.