Sample Header Ad - 728x90

"Command not found" when using ssh and non absolute commands

16 votes
4 answers
65555 views
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)
Asked by Simon (319 rep)
Jan 8, 2019, 05:09 PM
Last activity: Jul 10, 2024, 07:59 PM