I want to use a command over ssh:
ssh myuser@myhost mycommand
but doing so I always get:
sh: mycommand: command not found
using following obviously works:
ssh myuser@myhost /usr/local/bin/mycommand
and i understand why: it's because the command is somehow executed over a non-login shell.
Using the full command or any other parameters in my ssh command is not an option in my scenario. My command is executed by a script I cannot touch and worked on every host yet except this one.
The host that's giving me the problem is a Synology NAS and the /etc/passwd setting for that myuser is:
myuser:x:1048:100::/var/services/homes/myuser:/bin/sh
Again:
I can:
- ssh as myuser into myhost
- execute as myuser using the absolute path provided by which mycommand
- execute mycommand (non absolute) when already on myhost (via ssh)
I can't but want:
- execute: ssh myuser@myhost mycommand (non absolute, no additional parameters)
ssh user@host bash -lic mycommand
– glenn jackman Jan 08 '19 at 17:48