Problems setting PATH for ssh remote commands



I would like to execute a program via ssh without login
I have the program in the home folder like this: /my/myprogram

Then I try to execute it
[font=Courier]ssh (name)@(host) -p 2222 “myprogram”[/font]

and always says “command not found”

even I have tried to put the PATH in .bashrc, .bash_profile like this:
export PATH[/font]

Always that I tried this is the same output:
[font=Courier]ssh (name)@(host) -p 2222 "echo $PATH"

PS. Also tried to define PATH in .ssh\environment but didn’t work

Any solutions?


If I indicate explicitly the path to the program when executing /home/name/my/myprogram , it will prompt:
jailshell permission denied

It does it even I’m login in an interactive bash shell. why I can’t execute programs indicating the path


Try ~/my/program

Without knowing more about your full command, that’s all I can suggest. I’m guessing that it’s a .sh type executable (shell script), so in my case, I use something like:
ssh ~/bin/


Use Keychain and you use your own programs? normally I wrote a script to execute my programs on remote machines (for path and another info) so I do ssh sh

Maybe you only need ssh sh program
(on a second thought)


Thanks sdayman and vicm3, I didn’t realize about using the full path of the program. So is working :slight_smile: