0

TL;DR

This works:

ssh [email protected]
$ qconfig

But these do not work (which makes no sense to me, as they should be the same):

ssh [email protected] qconfig
sh: qconfig: cannot execute - No such file or directory

or

ssh [email protected]
$ sh
$ qconfig
sh: qconfig: cannot execute - No such file or directory

I want to use ssh [email protected] "some; commands; including; qconfig". How?

Long Version

I have a command which I would like to submit to a remote host via a non-interactive ssh command or from sh sub-shell, but it is not found when submitted that way even though it is found during a normal, interactive session.

Details:

OS: QNX

Shell: sh

Interactive command in which everything works as expected: ssh [email protected] then supply qconfig at prompt

though if I do sh then qconfig at this point, it does not work in that sub-shell

Non-interactive command in which things do not work: ssh [email protected] qconfig

Example:

[me.LOCAL-PC] > ssh [email protected]
[email protected]'s password:
remotehost:/home/me $ echo $SHELL
/bin/sh
remotehost:/home/me $ qconfig
<…> (it works fine here)
remotehost:/home/me $ sh
remotehost:/home/me $ qconfig
sh: qconfig: cannot execute - No such file or directory
remotehost:/home/me $ exit
remotehost:/home/me $ sh -c qconfig
sh: qconfig: cannot execute - No such file or directory
remotehost:/home/me $ exit
[me.LOCAL-PC] > ssh [email protected] qconfig
[email protected]'s password:
sh: qconfig: cannot execute - No such file or directory

I'm not very familiar with QNX, so I wasn't sure if qconfig was a built-in or not. It would make sense that it is since qconfig is not on my PATH, and if I do which qconfig it says which: no qconfig in /usr/bin:/bin:<…>.

I have since seen that there is a QNX qconfig as seen at this link, but I'm not so sure that's what is executing even when it does work for me since the one I am using does not accept the command line options listed at that page - I tried -a, -b, and -c and it said -a: No such file or directory.

What are the differences that could cause such a problem? More importantly, how do I get the ssh [email protected] <command> shell to correctly use the command the same as the ssh [email protected] shell does?

1
  • So I figured out how to work around this specific command. Unfortunately, I now have similar problems with other commands as well which are no aliased, but the nuances are different and that would be a different question. Commented Jun 14, 2019 at 21:11

1 Answer 1

0

And of course, after endless searching and hair-pulling I finally ask here on StackExchange, but then I finally figure it out just a half hour later.

Check to see if your command is an alias.

remotehost:/home/me $ alias
qconfig='some other command'

If it is an alias that is not getting set, then you could directly supply the command that your alias would do. So if qconfig='some other command', then do ssh [email protected] some other command

Apparently someone set up the system so that the command I am trying to run is aliased. I am used to working on machines where which <command> will tell you if the command is an alias, so I did not think to check that in this case.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.