Can’t Transfer Files To vCenter Server 7.0

Yesterday, 2012-12-13, i once again encountered the problem of not being able to pscp files to my vCenter Server. i have run in to this a few times over the years and now it was time to write down the solution.
When trying to run pscp.exe to transfer a file to vCenter Server 7.0U2d i’m getting the following error:

unable to initialise SFTP: could not connect

The reson for this error is that bash is not the default shell for vCenter Server, since a few versions back, as you probably know.  The default shell is appliancesh and to successfully run the pscp command and transfer files you need to change it. Enable SSH for your vCenter Server Appliance, log in to the vCenter Server Appliance via ssh and run two commands:

  1. shell – to enable the bash shell
  2. chsh -s /bin/bash root – to set bash as default shell.

When done you can successfully run pscp and transfer the file(s) needed. Don’t forget to revert back the configuration, meaning setting the default shell to appliancesh via the following command:

chsh -s /bin/appliancesh root

This is also described in VMware Knowledge base article 2107727