Score:0

Brocade FabricOS 8.2.2d: "rbash: setcontext: command not found" through SSH

cn flag

Context:

I’m writing a script that monitors all SFPs on a Brocade SAN switch and needs to iterate over all FabricID contexts.

When I log into a FabricOS 8.2.2d (also with 9.0.1) device through SSH then type:

setcontext <FID>

then the command behaves properly.

But when (as part of my script) I try to run the same command non-interactively via:

ssh <username@hostname> setcontext <FID>

then I get the following error message:

rbash: setcontext: command not found

What puzzles me is that other commands, such as showsfp, switchshow (that I intend to run after setcontext) work in both cases. I don’t understand what’s special about setcontext that makes it impossible to run non-interactively.

EDIT: More findings using command -V (https://man.cx/command):

command -V sfpshow
sfpshow is hashed (/fabos/link_bin/sfpshow)

command -V setcontext
setcontext is a shell builtin

Could that explain why I can run the former but not the latter command through ssh?

breversa avatar
cn flag
For the record, I’ll be exploring this next: https://community.hpe.com/t5/hpe-eva-storage/hp-8-40-sanswitch-remote-commands/td-p/5204687
Score:0
in flag

From the ssh manual:

If a command is specified, it will be executed on the remote host instead of a login shell.

A login shell will read some configuration files which usually set variables like $PATH, so when no login shell is invoked you usually end up with a different environment.

rbash indicates that on this machine a restricted bash is running, so the -l parameter of bash to invoke a login shell should work.

ssh <username@hostname> bash -l setcontext <FID>

Another option could be to use the full path to setcontext, since it's most probably the $PATH variable that is missing.

breversa avatar
cn flag
THANK YOU for you reply! Unfortunately, bash isn’t installed on the device: `rbash: bash: command not found`. I also don’t know the full path to `setcontext`, and rbash prevents the use of `/` (slash) anyway.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.