Roger Luo

超越梦想一起飞
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

SharpSSH

Posted on 2013-07-07 16:40  Roger Luo  阅读(861)  评论(0编辑  收藏  举报

SharpSSH

sharpssh is a pure .NET implementation of the SSH2 client protocol suite. It provides an API for communication with SSH servers and can be integrated into any .NET application.

Download: link

Background

SSH: Security Shell Protocol, Application layer prototol

Picture 2013-07-07 16_14_07

SCP: Secure copy or SCP is a means of securely transferring computer files between a local host and a remote host or between two remote hosts. It is based on the Secure Shell (SSH) protocol.

The term SCP can refer to one of two related things, the SCP protocol or the SCP program.

SFTP

sFTP 为 SSH的一部份,是一种传输档案至 Blogger 伺服器的安全方式。其实在SSH软件包中,已经包含了一个叫作SFTP(Secure File Transfer Protocol的安全文件传输子系统,SFTP本身没有单独的守护进程,它必须使用sshd守护进程(端口号默认是22)来完成相应的连接操作,所以从某种意义上来说,SFTP并不像一个服务器程序,而更像是一个客户端程序。SFTP同样是使用加密传输认证信息和传输的数据,所以,使用SFTP是非常安全的。但是,由于这种传输方式使用了加密/解密技术,所以传输效率比普通的FTP要低得多,如果您对网络安全性要求更高时,可以使用SFTP代替FTP。

和ftp不同的是sftp/scp传输协议默认是采用加密方式来传输数据的,scp/sftp确保传输的一切数据都是加密的。而ftp一般来说允许明文传输,当然现在也有带SSL的加密ftp,有些服务器软件也可以设置成“只允许加密连接”,但是毕竟不是默认设置需要我们手工调整,而且很多用户都会忽略这个设置。

scp/sftp属于开源协议,我们可以免费使用不像FTP那样使用上存在安全或版权问题。所有scp/sftp传输软件(服务器端和客户端)均免费并开源,方便我们开发各种扩展插件和应用组件。
小提示:当然在提供安全传输的前提下sftp还是存在一些不足的,例如他的帐号访问权限是严格遵照系统用户实现的,只有将该帐户添加为操作系统某用户才能够保证其可以正常登录sftp服务器。

http://sourceforge.net/projects/sshwindows/

Picture 2013-07-08 20_16_17

Picture 2013-07-08 20_16_33

Picture 2013-07-08 20_16_42

Picture 2013-07-08 20_16_53

Picture 2013-07-08 20_17_44

go to the installation directory “C:\Program Files (x86)\OpenSSH\bin”, execute the script like this:

mkgroup -l >> ..\etc\gropup
mkpasswd -l >> ..\etc\passwd

小提示:一般sftp用默认的22端口发布服务就行。如果你有特殊的原因要把这个端口改掉,请编辑C:\ProgramFiles\OpenSSH \etc\sshd_config文件,把这一行改成你要的端口,比如8029,设置完毕后需要重启openssh服务(任何配置改动都需要重启服务)。

Picture 2013-07-08 20_48_12

如果遇到上述错误,请下载如下zip包,并将里面的cygintl-2.dll与cygwin1.dll复制到openssh安装目录bin\。 也可以从别的地方cygwin中拿来用,不过其中cygintl-8.dll已经改名成cygintl-2.dll。

启动openssh

net start opensshd

使用ssh进行登录

ssh administrator@localhost

如果是第一次链接,会出现如下信息

The authenticity of host 'localhost (127.0.0.1)' can't be established.
RSA key fingerprint is xxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)?

在windows的机器上可能还会出现以下提示的机器上可能还会出现以下提示

Could not create directory '/home/UserName/.ssh'.

这是由于目录/home/UserName/.ssh不存在造成的,在下面的设置里,将会更改/home目录并创建用户目录

 

Usage