Ah...Windows, why you no easy?
SITREP:
-
You have a Windows Machine ????.
-
You have a linux machine ????.
-
Sensitive data needs to get from 1 to 2 securely ????.
SOLUTION:
-
Secure linux with SSH authentication.
-
Install PuTTY.exe on Windows: https://the.earth.li/~sgtatham/putty/latest/x86/putty.exe.
-
Install PSFTP.exe on Windows: https://the.earth.li/~sgtatham/putty/latest/x86/psftp.exe. But why not SPCP? Answer.
-
Make SSH connection via Putty to linux machine using existing SSH keys. Be sure to give your site a simple name (eg somePuTTYsitename) rather than use its IP address in the Saved Sessions field. Guide here.
-
Test PSFPT (this is all windows, btw): Open Start > Run > cmd.exe
cd c:\psftp (or where ever you installed PSFTP).
psftp
Enter linux machine username.
Enter SSH key passphrase
cd /var/www/html/location/
put c:\somelocalfilefromwindows.txt
exit
-
Check remote location on linux server via PuTTY.exe or Filezilla.
-
Reward yourself with adult beverage (mandatory).
Lets make it automated. We'll set up a simple bat file so Windows can look there as a startup item. The bat file will trigger a Visual Basic (VB) script that replicates our manual command line structure. You'll need to replace the information with your own.
Batch file, save as whateveryouwant.bat:
@echo
title LAUNCH PSFTP TO UPLOAD INTO LIVE LINUX SERVER
wscript "c:\psftp\yourVisualBasicScript.vbs"
Add to Windows Statup entry, here how to do that on Windows 7/8/10: http://www.thewindowsclub.com/how-to-schedule-batch-file-run-automatically-windows-7
Create the VB script (that'll you place inside the psftp folder (or where ever you have it) on C: drive on Windows):
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe", 9
WScript.Sleep 500
WshShell.SendKeys "cd c:\psftp"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "psftp"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "open somePuTTYsitename"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "someLinuxuser"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "someSSHpassphrase"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "cd /somelinuxdirectory/"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "put c:\somewindowsdirectory\somefile.xxx"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "exit"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "exit"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
Question: Why not use SPCP?
Answer: SPCP can only utilize putty generated keys, not OpenSSH keys your linux machine utilizes by default. Putty does have an SSH converted key file tool but since it changes the SSH key the linux machine will still [rightly] refuse it.
If you need help connecting your various Windows and Linux machines and safely transport data securely from a local machine and to the cloud (and vice-versa) gripfastistech.com can help! Ask a question below, comment or contact us directly to start the conversation!
Comments powered by CComment