2

I need to use plink (or something similar if you have something on mind) to get the output from Debian remote machine onto my Windows box. This works e.g. in this case :

plink 192.168.1.5 "ls" > log.txt

But when I want to use different command like e.g. ifconfig or what is my point of interest my alias for the script I get the error command not found :

Server sent command exit status 127
bash: showip: command not found
Disconnected: All channels closed

Where does the plink look for commands in this case ? I can easily execute aforementioned commands.

3

plink is running non-interactively and therefore doesn't get your normal shell setup; in particular $PATH is going to be the default (typically /bin:/usr/bin:/usr/local/bin or some permutation thereof). In particular it will have neither your personal bin directory (wherever you put it) or /usr/sbin where many tools like ifconfig live.

  • You can always use getconf to show the details. For example, ssh localhost '/usr/bin/getconf PATH' returns /bin:/usr/bin on my system. – CodeGnome May 28 '12 at 6:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.