One of the benefits of the Virtual I/O server is the predictability of its commands. Commands to list something start with ls and device names are prefixed with the pretty guessable -dev
In fact, I once wrote an article in praise of the VIOS command line interface (CLI).
But [language warning] boy, oh boy, do I find it confusing remembering whether I'm using the restricted shell (logged in as the user padmin) or switching to the full-blooded, no decaf, root access. You do that using the command oem_setup_env (as anyone would have guessed).
Jumping the Gate of the Restricted Shell
Now maybe, like me, you avoid damaging your VIOS environment by avoiding that oem_setup_env command. But just between you and me (and just about every other AIXer I've ever met), sometimes it's nice to have, isn't it? Like when you're playing with disk device drivers that you simply can't install or configure in the restricted shell.
It can be very frustrating remembering if you're padmin (restricted) or effectively root (oem_setup_env), so when you're logged in as padmin and run a typical root command, and then get an error, you're likely to set up an alias like this in /home/padmin/.profile
alias aix="ioscli oem_setup_env"
And then log in as padmin and run aix every time. Full shell, here we come!
Except you're not supposed to do that!
If you really, really, really have to go to the full shell, just for one command, there's another way. It's insanely obvious, which is probably why it took me 9 years even to think about it and then I didn't think about it at all. It was sent to me by John Tucker, an AIX enthusiast in the US and a reader of this blog. So a tip of the Akubra hat to you, mate.
when you want to run a command as root, but you're logged in the restricted shell as padmin, run the command as padmin but pipe it to oem_setup_env
So, if you want to run a command such as uptime to see how long since the last reboot, there's probably a few ways of doing this in the restricted shell, but good luck working out what they are.
You run uptime and you get a friendly message to tell you that you made a mess of it.
Sure, you could do the oem_setup_env thing and then run uptime, then exit (of course) to take you back to the restricted shell, but why not just try using the pipe?
Here's how it looks (wrong, then right):
Isn't that nice? It still doesn't exactly protect you from jumping the wall of the restricted shell and then going wild wiping out your VIOS, but at least it's keeping you more or less on the right side of the law.
Thanks again to John Tucker. I couldn't afford to send you an Akubra, John, but here's a link to the Wikipedia article on this iconic Australian headwear.