代码之家  ›  专栏  ›  技术社区  ›  Madir

可编程、安全的FTP替换

  •  2
  • Madir  · 技术社区  · 18 年前

    为了安全起见,我们需要摆脱传统的FTP(它不加密地传输密码)。我听到宋承宪被吹捧为显而易见的选择。然而,我一直在从ASP.NET程序界面驱动FTP来自动化我的网站开发,这现在是一个高度支持web的过程。

    有人能推荐一种安全的方式来传输文件吗?它有一个我可以从ASP.NET驱动的程序接口?

    5 回复  |  直到 18 年前
        1
  •  4
  •   Srikanth    18 年前

    sharpssh 实现通过scp发送文件。

        2
  •  3
  •   Martin Vobr    16 年前

    1) 安全传输协议的选择

    旧FTP的安全版本已经存在——它被称为FTP/SSL(通过SSL加密的普通旧FTP通道)。也许您仍然可以使用旧的部署基础架构—只需检查它是否支持FTPS或FTP/SSL。

    您可以在以下位置查看有关FTP、FTP/SSL和SFTP差异的详细信息: http://www.rebex.net/secure-ftp.net/ 页

    2) 用于Windows的SFTP或FTP/SSL服务器

    选择使用SFTP还是FTPS时,必须部署适当的服务器。对于FTP/SSL,我们使用Gene6( http://www.g6ftpserver.com/ )在多个服务器上没有问题。有很多FTP/SSL Windows服务器,所以可以随意使用。使用SFTP server for Windows时,情况要复杂一点——只有少数几个可用的实现。Bitvise WinHTTPD看起来很有前途( http://www.bitvise.com/winsshd ).

    3) ASP.NET的Internet文件传输组件

    解决方案的最后一部分是从asp.net进行安全文件传输。市场上有几种组件。我推荐 Rebex File Transfer Pack

    下面的代码显示了如何通过SFTP将文件上载到服务器。代码取自我们的 Rebex SFTP tutorial page .

    // create client, connect and log in 
    Sftp client = new Sftp();
    client.Connect(hostname);
    client.Login(username, password);
    
    // upload the 'test.zip' file to the current directory at the server 
    client.PutFile(@"c:\data\test.zip", "test.zip");
    
    // upload the 'index.html' file to the specified directory at the server 
    client.PutFile(@"c:\data\index.html", "/wwwroot/index.html");
    
    // download the 'test.zip' file from the current directory at the server 
    client.GetFile("test.zip", @"c:\data\test.zip");
    
    // download the 'index.html' file from the specified directory at the server 
    client.GetFile("/wwwroot/index.html", @"c:\data\index.html");
    
    // upload a text using a MemoryStream 
    string message = "Hello from Rebex SFTP for .NET!";
    byte[] data = System.Text.Encoding.Default.GetBytes(message);
    System.IO.MemoryStream ms = new System.IO.MemoryStream(data);
    client.PutFile(ms, "message.txt");
    

        3
  •  1
  •   Galwegian    18 年前

    我们使用了 this solution

        4
  •  1
  •   Hank Gay    18 年前

    FTP的传统安全替代品是 SFTP rsync 取而代之的是:它是高度可配置的,只需告诉它使用ssh即可确保安全,而且在保持两个位置同步方面效率更高。

        5
  •  0
  •   Community Mohan Dere    6 年前

    G'day,

    你可能想看看 ProFPD .

    从他们的网站:

    ProFTPD源于对安全和可配置FTP服务器的渴望,以及对ApacheWeb服务器的高度赞赏。

    我们使用经过调整的版本来大规模传输web内容。通常每天更新300000次。

    干杯

    抢劫