• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Run VIO commands from the HMC using “viosvrcmd” without VIOs Passwords

by admin

IBM Systems Director can not only gather standard inventory information from the operating system running inside the VIOS but also virtualized resources. This information comes from the communication with the Hardware Management Console and the viosvrcmd command. The virtual resources and the client LPARs are stored in the Systems Director database. There is nothing to be configured on the VIOS for this data gathering.

Recently we got a situation where we don’t know the passwords of either padmin/root of VIOS but need to run commands in VIOs. Found an interesting command in HMC called “viosvrcmd“, which will enable us to run commands on VIOs through HMC.

# viosvrcmd -m managed-system {-p partition-name | --id partition-ID} -c "command" [--help]

Description: viosvrcmd issues an I/O server command line interface (ioscli) command to a virtual I/O server partition.

The ioscli commands are passed from the Hardware Management Console (HMC) to the virtual I/O server partition over an RMC session.

RMC does not allow interactive execution of ioscli commands.

  • -m: VIOs managed system name.
  • -p: VIOs hostname.
  • –id: The partion ID of the VIOs.
  • -c: The I/O server command line interface (ioscli) command to issue to the virtual I/O server partition.
  • –help: Display the help text for this command and exit.
Note: You must either use this option to specify the ID of the partition, or use the -p option to specify the partition’s name. The –id and the -p options are mutually exclusive. The command must be enclosed in double quotes. Also, the command cannot contain the semicolon (;), greater than (>), or vertical bar (|) characters.

Here is an example:

hscroot@umhmc:~> viosvrcmd -m umfrm570 -p umvio1 -c "ioslevel"
2.2.0.0

Since we can’t give the ; or > or | in the command, if you need to process the output using filters, you can use that after “”.

hscroot@umhmc:~> viosvrcmd -m umfrm570 -p umvio1 -c "lsdev -virtual" | grep vfchost0
vfchost0         Available   Virtual FC Server Adapter

What if you want to run command as root (oem_setup_env)? I’ve got a method from internet:

hscroot@umhmc:~> viosvrcmd -m umfrm570 -p umvio1 -c "oem_setup_env
> whoami"
root

You can run in one shot like below:

hscroot@umhmc:~> viosvrcmd -m umfrm570 -p umvio1 -c "oem_setup_env\n whoami"
root

If you need to run multiple commands, you can use them by assigning the commands to a variable and calling the variable in place of the command parameter.

hscroot@umhmc:~>command=`printf  "oem_setup_env\nchsec -f /etc/security/lastlog -a unsuccessful_login_count=0 -s padmin"`

hscroot@umhmc:~>viosvrcmd -m umfrm570 -p umvio1 -c "$command"

Conclusion

When integrating with VIOS, PowerVM NovaLink uses the viosvrcmd command, which allows a legitimate user to run commands against a VIOS in a manner similar to the HMC viosvrcmd command.

Filed Under: AIX

Some more articles you might also be interested in …

  1. Backup Command Examples in AIX
  2. How to find CPU, Memory(RAM), Hard disks, IP address information in AIX
  3. Using savevg on AIX to save time creating filesystems, LV’s and volume groups
  4. What is VIOS?
  5. Procedure to mount and unmount NFS filesystems on AIX
  6. vmstat output explained
  7. Memory utilization of processes in AIX
  8. Adding Static Routes On Various *NIX (Linux,AIX,HP-UX)
  9. AIX HMC CommandLine Reference (Cheat Sheet)
  10. How to set the value of “maximum user processes” on IBM AIX

You May Also Like

Primary Sidebar

Recent Posts

  • raw: command not found
  • raw Command Examples in Linux
  • rankmirrors Command Examples in Linux
  • radeontop: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright