I have Kali 4.19 loaded onto a Raspberry Pi 4, and am communicating with it using a ParrotOS VM on a separate host.
I noticed some strange behavior when sending commands to my Kali Pi over SSH. I can send familiar commands such as ifconfig and shutdown to it, and both have the expected behavior (the former shows the correct information about the remote machine, and the latter shuts it now).
When on the Kali Pi itself, if I open up a terminal and type either of the above commands, I get
brendon@kali:~$ ifconfig
bash: ifconfig: command not found
brendon@kali:~$ shutdown
bash: shutdown: command not found
I understand that ifconfig is deprecated, and that shutdown can come from different packages, so neither is necessarily guaranteed to exist.
What confuses me though is that it works over SSH, but not when on the machine. I assumed when I send a command, it gets encrypted as text, sent to the other machine, decrypted to text, then eval'd locally using a exec* call or something similar. Then the reverse happens to the response. That fact that it works over SSH though suggests that something else is going on.
If I which ifconfig over SSH, I get a return code of 1, which indicates that "one or more specified commands is nonexistent or not executable". And yet it still works.
Can someone explain what's happening here?
type ifconfigin the SSH shell?type ifconfiggivesifconfig is hashed (/usr/sbin/ifconfig).$PATHis different in the local shell from the remote?sbindirectories, whereas the local session doesn't. I'll just change the default PATH on the machine. Thanks.