When working within your ShellsTM using Ubuntu at times you may want to transfer files back and forth from your Windows PC to Ubuntu or vice versa. This can be done by generating an SSH key on Windows and using SCP (Secure Copy) to move files from one host to another securely. On your Windows PC you will need to use two applications to get this to work, Putty’s Key Generator tool and WinSCP.
The software can be downloaded from the following:
Transferring files from Ubuntu to Windows using SCP
STEP 1 – Generating your SSH Key using Putty’s Key Generator from Windows:
After you have Putty downloaded, do a search for PuttyGen on bottom left of your Windows PC and click to open once you have a search result. If Putty Key Generator has been opened, you should see a window like this below:
In Putty Key Generator, leave the “Type of key to generate” as default “RSA” and click on Generate and continue to mouse over the blank area as instructed to generate the keys. Once generated, you can enter a passphrase or leave blank and save your keys.
From here you can copy your key located underneath where it states “Public key for pasting into OpenSSH authorized_key file” and paste it into your Shells Keychain.
If you have not, yet, created a Keychain, please see article: How to add an SSH key on your Shells console
STEP 2 – Configuring your Shell with WinSCP to transfer files:
Open up WinSCP, and select New Site and configure the following:
- File protocol: SCP
- Host name (shells IP address)
- Port (default 22 or enter the port number if you have changed the default SSH port)
- Your Ubuntu username (No password needed as we are authorizing with SSH keys)
After that, click the Advanced tab and select the Authentication tab on the left pane. We can then select the Browse button where it states Private key file. Click OK and Save.
You can now select your host on the left side and click Login.
Once connected, you can drag and drop files back and forth. Below shows my session with my Windows directory on the right and my Ubuntu directory on the left.