For some this may be a rare situation but from time to time I find that I’m needing to copy files to and from a vCenter Server Appliance (VCSA). I had one of these situations recently on vCenter 6. I needed to move some log files off a VCSA box.
I’ve found the easiest way to do this is via SCP -- Secure Copy, which uses the SSH protocol. It’s a relatively simple process to enable the VCSA to accept SCP connections. It’s a two step process which first requires enabling SSH on the VCSA and then switching the default Shell.
Step 1, involves enabling SSH
I’ve written a previous post on how to enable SSH on a VCSA here. Since that post VMware have re-released the VAMI on vCenter Server Appliance V6 U2. So I thought I might show this new method to enable SSH. Only if using VCSA 6 U2 or greater else use my previous post steps.
Connect to the VAMI URL of your vCenter on port 5480 using HTTPS. In my case it was https://vc.ukoticland.local:5480/login.html
Login with your VCSA root account and password. Then navigate to Access and click Edit on the far right. Select Enable ssh login and to make life a little easier also Enable bash shell and click OK. The timeout refers to how long the Bash shell will stay enabled. The default is fine.
Step 2, changing the default shell
Even though we enabled the bash shell above the default shell is still the VMware appliance shell which prevents us from connecting to the VCSA via SCP. So we need to SSH to the VCSA and change the default Shell from the Appliance Shell to Bash.
In my case I used Putty. Logged in with my root account and type shell.
Now i can change the default shell for the root user to bash using the below command.
chsh -s /bin/bash root
We’re now ready to SCP to our VCSA with the ability to transfer files to and from the VCSA. I use the simple Windows app, WinSCP. I change the File Protocol to SCP. I enter in my vCenter as my host and my root credentials.
When you’re complete just reverse the changes you made. In the SSH Putty session type the below to permanently switch the Bash shell back to the default Appliance Shell. Then log back into the VAMI as above. In Access deselect SSH and Bash.
chsh -s /bin/appliancesh root
References
Toggling the vCenter Server Appliance 6.x default shell (2100508)