安装WinSSHD实现Windows下的SSH协议并配置信任Linux客户端

1.下载WinSSHD软件的安装包,本人测试使用的版本为WinSSHD5。(下载方式很多,百度上搜索一下“WinSSHD5”,工具也叫“Bitvise SSH Server”)

2.运行安装exe文件,按照操作步骤进行安装。

勾选“I agree……”,可自定义选择安装路径,然后点击Install按钮

选择“Personal edition”,点击OK按钮。

【注意:“Standard edition”需要购买,否则30天之后会过期。如果没有较多连接数等要求,可以使用“Personal edition”。需要购买标准版本的除外!】

输入名字信息,然后点击OK按钮

点击“OK”按钮。

点击“Open easy setting”,打开配置页面

选择“Open port(s) to any computer”,然后点击Next按钮

去掉图中的勾选项,不让使用windows账号登陆。然后点击“3.Virtual accounts”选项卡。

点击add按钮,创建一个虚拟账户

先输入用户名,然后勾选,设置密码

完成密码设置之后,点击OK按钮。

点击“Save changes”按钮,回到主面板。

在主面板上点击Start Server按键。

如果有需要关闭ssh服务,可以点击“Stop Server”按键。

然后执行cmd进入命令行输入框,执行“netstat -ano | findstr 22”命令,查看22(ssh)端口是否开启。

显然22(SSH)端口已经开启。

3.登陆Linux系统,执行scp命令向winserver服务器拷贝文件,查看结果。

test@CHAPP:~> echo "hello world" >> a.txt

test@CHAPP:~> cat a.txt

hello world

test@CHAPP:~> scp a.txt [email protected]:/C:/key

The authenticity of host '182.207.3.210 (182.207.3.210)' can't be established.

DSA key fingerprint is 71:b2:88:c7:f7:cd:b9:ec:31:2e:13:54:6b:76:0f:8c [MD5].

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '182.207.3.210' (DSA) to the list of known hosts.

[email protected]'s password:      【这里输入sshuser用户的密码】

a.txt        100%  12    0.0KB/s  00:00   

test@CHAPP:~> rm a.txt

同时,也可以在winserver上打开文件查看。

4.登陆Linux主机,在相关用户下执行如下命令,生成公钥:

# ssh-keygen -t rsa (连续三次回车,可以生成公钥和私钥)

将在Linux主机的当前用户HOME目录下的.ssh目录,生成id_rsa.pub和id_rsa,其中,id_rsa是密匙,id_rsa.pub是公匙

test@CHAPP:~> cd ~/.ssh
test@CHAPP:~/.ssh> scp id_rsa.pub [email protected]:/C:/key/authorized_keys

[email protected]'s password:          【这里输入sshuser用户的密码】

id_rsa.pub      100%  399    0.4KB/s  00:00

5.将公匙导入到WinSSHD

进入Open easy setting–>Virtual accounts选项卡

点击Edit按钮

点击“Public keys”

点击Import,导入刚才从Linux系统传过来的公钥(authorized_keys),然后点击Close。

点击OK按钮。

6.再次通过Linux系统进行传输,检查能否正常传输。

test@CHAPP:~/.ssh> scp id_rsa.pub [email protected]:/C:/key/authorized_keys

[email protected]'s password:

id_rsa.pub      100%  399    0.4KB/s  00:00

显然已经得到认证,无需输入密码即可进行传输。

7.如果需要配置信任多个Linux客户端,可在windows下建多个文件夹,如key1,key2……,用于存放不同Linux客户端传过来的公钥文件(authorized_keys),然后依次将公匙导入到WinSSHD。

至此,安装WinSSHD实现windows下的SSH协议并配置信任Linux客户端操作完成!

说明一点,这是使用虚拟账户连接Windows系统,也可以使用Windows账户连接Windows系统,只需在安装步骤中,允许使用windows账号登陆,并进行配置。

猜你喜欢

转载自www.linuxidc.com/Linux/2017-07/145984.htm
今日推荐