Skip to content

Getting a root shell over SSH

Nearly every recipe in chapters 1 and 2 runs commands as root on the appliance: vracli, kubectl, deploy.sh. From 9.1.1 you no longer log in as root to do that. You SSH in as vmware-system-user and switch to root with sudo . This recipe shows that login, turns SSH on and off, and keeps it tidy. Every other recipe that says “as root” means this.

Getting ready

  • A standalone appliance deployed as in recipe 1.2.
  • The password of vmware-system-user, and the password sudo asks for.
  • Access to the appliance’s VM console in the vSphere Client, for the first time, when SSH may still be off.
Needs a lab check. Broadcom documents this login for the VCF Automation appliance (KB 422955: SSH as vmware-system-user, then sudo su -), and the same login is reported for 9.1.1 Orchestrator appliances, but it hasn’t been tried in this book’s lab yet. Broadcom’s VCF 9.1 account list still shows only root and admin for a standalone Orchestrator. On a fresh 9.1.1 OVA deployment, record where the vmware-system-user password is set (its own field on Customize template, or the root password), and which password sudo su - asks for.

How to do it

Log in and become root

  1. From your workstation, log in as vmware-system-user:
workstation
ssh vmware-system-user@vco01.vmw.lab

If the connection is refused, SSH is off. Turn it on from the console first (steps 4 to 6), then come back.

  1. Switch to root:
vmware-system-user@vco01
sudo su -
  1. Check that you’re root and that the appliance answers:
root@vco01
whoami # root
vracli vro info

Type exit twice when you’re done: once to leave the root shell, once to close the SSH session.

Turn SSH on from the console

  1. In the vSphere Client, select the appliance VM (vco01) and click Launch Web Console.
  2. Log in at the console’s prompt as vmware-system-user and run sudo su -, as in step 2.
  3. Turn SSH on:
root@vco01 (console)
/usr/bin/toggle-ssh enable
Figure 2.1. Turning SSH on from the appliance console.

Turn SSH off again

  1. When you’ve finished, turn SSH off. You can do this over SSH; your current session stays open until you log out:
root@vco01
/usr/bin/toggle-ssh disable
  1. Log out, and try ssh vmware-system-user@vco01.vmw.lab again. The connection should now be refused.

How it works

Why not root? Logging in as one shared administrator account gives anyone with that password full control and leaves no trace of who did what. With a named login account and sudo, root access is a separate, logged step. Broadcom gives the same reason for the VCF Automation appliance, where direct root login over SSH is turned off by default (KB 422955). root still exists and still owns everything; you just reach it through sudo.

sudo su - or sudo per command. sudo su - opens a full root login shell, with root’s environment and home folder, which is what the commands in this book expect. For a single command you can also prefix it: sudo vracli vro info. Keep to one style in a runbook, so that nobody wonders which user a command ran as.

SSH itself. The appliance runs a normal OpenSSH server on Photon OS. toggle-ssh is a small script shipped on the appliance that starts or stops that service and sets whether it starts at boot, so the setting survives a reboot. It’s the same switch as the SSH option on the Customize template page when you deploy the OVA (recipe 1.2, step 10). Ticking that box just saves you steps 4 to 6.

Needs a lab check. The /usr/bin/toggle-ssh enable and disable commands come from the Orchestrator 8.x documentation; the 9.1 page has the same title. Confirm the script exists on a 9.1.1 appliance and note its exact output for Figure 2.1, and check that enable survives a reboot.
Back in vRO 5.5–7Open the appliance management interface on https://appliance:5480, tick SSH service enabled, and log in as root.
In Orchestrator 9.xLog in as vmware-system-user and run sudo su -. Turn SSH on or off with toggle-ssh, or tick the option when you deploy.

There's more

Copying files to the appliance. scp logs in the same way, so copy files as vmware-system-user into its home folder, then move them as root:

workstation
scp vco01-chain.pem vmware-system-user@vco01.vmw.lab:~
root@vco01
mv /home/vmware-system-user/vco01-chain.pem /root/

Use a key instead of a password. Copy your public key to vmware-system-user once SSH is on, and you won’t need its password for every login or scp. sudo still asks for its own password:

workstation
ssh-copy-id vmware-system-user@vco01.vmw.lab

Harden what you keep. If your security team wants SSH left on, you can still tighten it. The SSH server reads /etc/ssh/sshd_config as usual, so you can remove ciphers and MACs your policy doesn’t allow. Restart the service afterwards with systemctl restart sshd, and keep the VM console open while you test, in case you lock yourself out. Don’t turn root login back on: it undoes the point of the change.

Needs a lab check. Edits to /etc/ssh/sshd_config may be overwritten by an appliance upgrade. Check whether a custom cipher list survives an upgrade from 9.1.1 to 9.1.2.

Clusters. In a three-node cluster (recipe 2.4), SSH and vmware-system-user are per node. Turn SSH on, and log in, on each appliance you need to reach.

No console access either? If you can reach neither SSH nor the VM console, you can’t run any vracli command. Ask your vSphere team for console access before you start a maintenance window.

See also