3

I want to run for example this command : ip addr on my remote system.
I do it like this :

ssh username@ip ip addr

but I got this error :

bash: ip: command not found

when I connect to remote system and then run this command it is ok, I mean it is not caused by uninstalled package. I want to get the result without connecting permanently.

1 Answer 1

5

easy: ssh remotehost "/sbin/ip addr"

Reason, the remote shell launched by ssh command to execute ip, have not ENV or just a basic one, and ip is not in the $PATH of the remote shell. So either you specify the full path of the command, or you source a working environment in the remote shell before running command.

1

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.