SSH shell commands

Custom shell commands can be enabled in the config.yaml. Commands can be found in aliases file.

In the SSH shell, backslash (\) is treated as an escape character and thus Windows paths such as C:\Windows need to be written as C:\\Windows by the SSH client.

Do NOT allow users to run commands that require user input. Such commands would effectively block the session as user input redirection is not supported.

Remember that users may use aliases to access files that are outside their root directory!

Windows impersonation disables custom shell commands for the user as impersonation is not supported for custom shell commands yet.

Syntax

# comment
mycommand1=path_to_exe arg1 arg2 arg3 ...
mycommand2=path_to_exe arg1 arg2 arg3 ...
...

Special parameters

  • $0- denotes the name of the command
  • $1 to $9 - denotes a positional parameter. Enclose in double quotes, unless you want to allow parameter splitting (see examples below).
  • $@ - expands the positional parameters, starting from one.
    • "$@": when the expansion occurs within double quotes, each parameter expands to a separate word. That is, "$@" is equivalent to "$1" "$2" ....
    • $@: when the expansion is not within double quotes, each positional parameter expands to a separate word. In contexts where it is performed, those words are subject to further word splitting and pathname expansion.
  • $* - expands the positional parameters, starting from one.
    • "$*": when the expansion occurs within double quotes, it expands to a single word with the value of each parameter separated by space. That is, "$*" is equivalent to "$1 $2 ..."
    • $*: when the expansion is not within double quotes, each positional parameter expands to a separate word. In contexts where it is performed, those words are subject to further word splitting and pathname expansion.

Examples

Alias definition Command Result Comment
foo=C:\foo.exe "$1" foo "Hello World!" C:\foo.exe "Hello World!" Parameters will map one to one
foo=C:\foo.exe $1 foo "Hello World!" C:\foo.exe Hello World! Parameters will be expanded
do=cmd.exe /c "$@" do "dir /s" cmd.exe /c "dir /s"
do=cmd.exe /c "$*" do dir /s cmd.exe /c "dir /s"
whatever="$@" whatever git status "git" "status"
*="$0" "$@" git status "git" "status"