IFCONFIG is available... sort of

So, I have this script that makes a call to ifconfig to pull the interface information and report it. When I log on to the machine the script works just fine. But, if I'm on a remote machine and I make a call like this.

ssh user@server ./script.bash

I get an error saying that the IFCONFIG command is unavailable. :confused: No idea why.

Everything is being run as a user. Naturally, root ssh is disabled.

What, exactly, does it say?

It's probably just not in your PATH. See 'whereis ifconfig' to find out where it's hiding on that system.

 
./sysinfo.bash: line 30: ifconfig: command not found

I also got the same error when I supplied the full path. I'd supply the script, but it's it's on a seperate network and I can't transfer the script to public domain.

The full path is /usr/sbin/ifconfig. And it runs fine if I do an actual login.

Did you check the full path on the remote system, though? It might be a different full path on your remote system than your local one.

See, mine is /sbin/ifconfig. /usr/ seems a bit odd to me.

Yes, I did. I modified the script on the remote machine to point to /usr/sbin/ifconfig which is where it's located. I don't have whereis so I used which. Which is pretty much the same. It's Solaris 10 on a sparc Netra-T5220.

Well then, check for typos or special characters like carriage returns in the file.

Older Solaris releases used to provide two different ifconfig binaries, one in /sbin and the other in /usr/sbin, with a slightly different behavior regarding the name service resolution order.
Recent releases have /usr/sbin/ifconfig being just a symbolic link to /sbin/ifconfig.

If you get an error message, please post the exact command you typed, what you expected to happen, and the exact error message you received. Accuracy is so important in computing.

First impression:
The ifconfig command is in lower carriage. Unlike Microsoft platforms, you cannot type unix commands in the wrong case. If you typed IFCONFIG , it will fail.

Assuming you typed the command correctly, what user are you using? i.e. Is it not root?

Ah... That fixed it.

Changed /usr/sbin/ifconfig to /sbin/ifconfig and it worked.

That means you have a separate file system for /usr and at the time your run your command, it's not yet mounted.