Windows桌面上的cygwin ssh快捷方式 [英] cygwin ssh shortcut from windows desktop

查看:56
本文介绍了Windows桌面上的cygwin ssh快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要远程访问多台服务器.我更喜欢Cygwin而不是Putty.

I have multiple servers that I need to remote into. I prefer Cygwin over Putty to do so.

Anyhows-打开我很酷的Mintty窗口,然后键入以下命令的过程将花费很长时间.PS-我正在对这些服务器使用密钥"身份验证.

Anyhows - the process of opening my cool Mintty window and then typing the following commands takes too long. PS - I am using a "key" authentication to these servers.

首先,我在Windows桌面上双击Cygwin Terminal快捷方式.

First, I double Click Cygwin Terminal shortcut from my windows desktop.

然后,一旦终端会话启动,从命令提示符下键入以下内容-

Then once the terminal session has booted up, from the command prompt I type the following -

$ eval `ssh-agent`
$ ssh-add
$ ssh <username>@<servername>

请记住,我的服务器名"是可变的.实际上,我大约可以在其中插入10个不同的服务器名称-因此,我需要10个不同的快捷方式.我希望双击桌面上的某个东西,这将启动Mintty并自动执行上述bash shell命令.

Please keep in mind that my 'servername' is variable. In fact I have about 10 different server names that could potentially be inserted there - Hence my need for 10 different shortcuts. I would prefer to double click on something from my desktop that will fire up my Mintty and automatically execute the above bash shell commands.

有人有或者可以推荐一个不错的/优雅的解决方案来做到这一点?

Does anyone have or can recommend a nice/elegant solution to do this?

(我感觉这与我单击的Windows快捷方式图标的Target属性有关.)

(I have a feeling that it has something to do with the Target attribute of the Windows short-cut icon that I am clicking on.)

推荐答案

为此,我执行了以下步骤:

To accomplish this I did the following steps:

第1步:创建一个我安装了Cygwin的目录,称为脚本

Step 1: Created a directory where I installed Cygwin called scripts

步骤2:在此目录中创建了一个名为servername.sh的BASH脚本

Step 2: In this directory created a BASH script called servername.sh

第3步: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)

第4步:创建Cygwin终端图标的快捷方式

Step 4: Created a shortcut of your Cygwin Terminal icon

第5步:将其粘贴到我想要的位置(在我的桌面上-但您可以选择要放置的位置).

Step 5: Pasted it where I wanted it (on my Desktop - but you can chose where you want to place it).

步骤6:右键单击并重命名我的快捷方式(将其命名为我的服务器名称)

Step 6: Right click and renamed my shortcut (name it my server name)

第7步:右键单击并选择属性

Step 7: Right click and select Properties

第8步:在目标属性"部分中,有以下代码行-

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!

干杯.

这篇关于Windows桌面上的cygwin ssh快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆