In this article, we will cover how to access your vSphere environment via SFTP (SSH File Transfer Protocol) with Linux/macOS and Windows.
Topics
- Accessing Your Datastore via SFTP with Linux/macOS
- Accessing Your Datastore via SFTP with Windows Using WinSCP
- Locating Saved Files in vSphere
Accessing Your Datastore via SFTP with Linux/macOS
To access your environment via SFTP from Linux or macOS, open Terminal and enter the following command:
$ sftp admin@pcc-192-0-2-18.ovh.us
Note: Replace your hostname (e.g., pcc-192-0-2-18.ovh.us) with your own.
You will then receive the following output. Type the responses (denoted in red text) when prompted:
The authenticity of host 'pcc-192-0-2-18.ovh.us (192.0.2.18)' can't be established.
RSA key fingerprint is SHA256:vp7m4GPWyH1Qe28Is3G6rRKANB4KTHUT9VemkULJn4w.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'pcc-192-0-2-18.ovh.us,192.0.2.18' (RSA) to the list of known hosts.
admin@pcc-192-0-2-18.ovh.us's password: your password
Connected to pcc-192-0-2-18.ovh.us. sftp>
Once you have successfully accessed your environment via SFTP, you can view your datastores using the following command:
sftp> ls
You will see your datastores in the output as follows:
pcc-xxxxxx pcc-yyyyyy
Once you have identified the datastore to which you wish to upload or download files, move into that datastore. To do so enter the following command:
sftp> cd pcc-xxxxxx
Note: Replace our datastore with yours.
Now you are able to access your datastore and upload files to it as needed.
Note: Uploaded files will be saved in an upload-vpn
directory.
Accessing Your Datastore via SFTP with Windows Using WinSCP
To access your environment via SFTP in Windows, an SFTP client is required. Windows does not come with one by default. A common, popular, and free SFTP client is WinSCP. After downloading and launching WinSCP, you will be presented with a "Login" screen. From this "Login" screen type in the hostname of your environment, the SSH port 22, and your vSphere credentials.
You may get a warning that pops up asking you to check that this is the correct host. After double checking that this is indeed the host you want, click Yes to continue.
In the new window, you will be able to navigate to your documents on the left-hand side; on the right-hand side, you will be able to navigate to your datastores. In this window, on the right-hand side, select the datastore in which you wish to upload your file.
Now, select the file you wish to upload from the left-hand side and click the Upload button.
In the new pop-up, simply click ok and your file will be uploaded. Next, we need to locate the file in vSphere.
Locating Saved Files in vSphere
Using the vSphere Client, select Datastores on the top menu bar.
Note: We are utilizing the HTML5 version of vSphere for this article, if you are using the flash version, this process may be different.
On this tab, select the datastore in which you uploaded your files. In our example, this is "pcc-000388".
From here, click the upload-vpn folder. Here we can view all of the files that we have uploaded using SFTP.
Conclusion
Now that you are familiar with connecting to an environment via SFTP, you can securely upload files to your datastore without using the vSphere Web Client.