PuTTY has been the go-to terminal/SSH software for Windows users pretty much forever, and for the vast majority of users it does the job and does it well enough. But I use CentOS as my desktop OS at work, and one of the things I did was to create shell scripts that would transparently execute remote GUI tools. And I placed them on my Gnome desktop so I could double-click on them and they'd behave like local applications. That's not possible using PuTTY and Windows - you need to log in then call the command at the prompt.
I apologize for the blasphemy I'm about to reveal... I actually like Windows 10. MS actually did a good job with UI/UX this time around, and I have no plans on replacing it with CentOS or Ubuntu as my desktop OS (unless my wife [one of these days] lets me buy a MacBook Pro). But I do like the trick I set up on my work desktop with setting up my remote tools as icons. After some thought, I came up with something very similar for Windows, using SSH tunnelling to access remote Linux tools, and without having to use a terminal tool like PuTTY to explicitly provide a password for each software session.
Software needed
- X server: I imagine any package will do, but I switched over to VcXsrv last year. I had used Xming for ages, but it's ancient and the free version hasn't been updated in a long time. And I don't use cygwin because I don't use all the other cruft that comes with it. That said, pick what you like best. Download VcXsrv here: https://sourceforge.net/projects/vcxsrv/
- Git for Windows: the bash window that comes with git is the big reason why I don't use cygwin. It gives me what I need in a thin package with tools that work transparently through Windows. Download git here: https://git-scm.com/downloads
Install X server
Installing VcXsrv is pretty straightforward, and Xming was similarly easy to install as well.
Visit here for installation details. If you want X to start when you log in, go to
C:\Users\<your username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup and make a shortcut to the executable:
For my startup shortcut I run the executable with the following options:
"C:\Program Files\VcXsrv\vcxsrv.exe" :0 -ac -terminate -lesspointer -multiwindow -clipboard -wgl
Install git
If you're not a software developer, you really won't have a need for git. And sure you can use mingw if you really want to start with a minimalist environment. But the git package provides SSH and openssl tools by default, and that will save loads of time and effort configuring those tools. (Personally I think git is the best thing since sliced bread.)
During installation you will be prompted to select your preference for using git in either bash or the Windows command prompt. Being more of a Unix person, I chose bash. I have no idea if anything I've done in bash can be done in the command prompt, and (since everything works the way I like it) I don't care.
Create and deploy SSH keys
The use of SSH keys is the secret sauce to this entire effort; it allows for you to log into your Unix/Linux machine without having to repeatedly log in and providing username and password.
Details on how to do this are available here, but to summarize the process (using git bash):
- Create your keys: ssh-keygen -t rsa. Do not provide a passphrase when prompted.
- Deploy your key to remote: ssh-copy-id -i ~/.ssh/id_rsa.pub username@remote_host
Create Windows batch file
I use the code below in my batch file to combine a couple of commands into a single call that I can link a shortcut to on my desktop:
@echo off
set DISPLAY=0.0.0.0:0.0
C:\Progra~1\Git\usr\bin\ssh.exe -YC username@remote_host "dbus-launch gnome-terminal --geometry=132x43 &"
SSH uses the keys made in the previous step to log into the remote host, and it then passes the command in quotes to run from the remote host.
Create and modify desktop shortcut
Create a shortcut to the batch file on your desktop. Once done, open the properties window:
And make sure Run is set to "minimized". If this is not set and you run the command, a command window will open in addition to the software you actually want to execute.