0

I am trying to run:

ssh name@serverIP "sudo speedtest-cli"

which after I type my password in I get:

sudo: speedtest-cli: command not found

However if I SSH on that mac, then run sudo speediest-cli, it works.

I have tried putting it in a script doing ssh -t name@serverIP "bash -s" < ./test.sh, it manages to read the script file ok and connect via ssh but still outputs :

sudo: speedtest-cli: command not found

Any ideas?

robmathers
  • 3,028
  • 1
  • 26
  • 29
musician2000
  • 59
  • 2
  • 6

1 Answers1

0

speedtest-cli is likely in a directory that doesn't get added to your PATH when you run a direct command via SSH, but does via shell. To find the full path, run which speedtest-cli, which will output a full path, such as /path/to/speedtest-cli. You can then use that full path to run the speed test:

ssh name@serverIP "sudo /path/to/speedtest-cli"
robmathers
  • 3,028
  • 1
  • 26
  • 29