I have multiple servers that I need to remote into. I prefer Cygwin over Putty to do so.
Anyhows - the process of opening my cool Mintty window and then typing the follo
To accomplish this I did the following steps:
Step 1: Created a directory where I installed Cygwin called scripts
Step 2: In this directory created a BASH script called servername.sh
Step 3: servername.sh will have the following contents (a single line):
eval `ssh-agent`;ssh-add;ssh user@servername
(Make sure you substitute user and servername with the appropriate information)
Step 4: Created a shortcut of your Cygwin Terminal icon
Step 5: Pasted it where I wanted it (on my Desktop - but you can chose where you want to place it).
Step 6: Right click and renamed my shortcut (name it my server name)
Step 7: Right click and select Properties
Step 8: In the Target attributes section I have the following line of code -
C:\Cygwin\bin\mintty.exe -e /bin/sh -l -c '/scripts/servername.sh'
And make sure your paths match up with your environment!
Cheers.
You can do this without too much difficulty. Copy the existing Cygwin Terminal icon, right click on it, and select Properties. You should see something like the below in the Target field:
C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -
Replace this with the following (replacing <username>
and <servername>
as relevant):
C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico /bin/bash -l -c "eval `ssh-agent` ; ssh-add ; ssh <username>@<servername>"
Repeat as necessary for your other servers. That's it!
(Detail: We replace the -
argument [which means to use the standard login shell] with an explicit call to bash to run your commands. The -l
part means to use a login shell, which in particular means your PATH
variable is set up and so bash can find ssh
. The -c
part just introduces the command, which you should recognize from your question.)