<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[SFTP - Lukas Pokorny]]></title><description><![CDATA[Thoughts, stories and file transfer.]]></description><link>http://lukas.pokorny.eu/en/</link><generator>Ghost 0.7</generator><lastBuildDate>Tue, 29 Dec 2020 21:58:44 GMT</lastBuildDate><atom:link href="http://lukas.pokorny.eu/en/tag/sftp/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Introducting SFTP over WebSockets]]></title><description><![CDATA[SFTP and WebSockets are a perfect match. The combination of these two protocols eliminates the need for the black magic of AJAX uploads.]]></description><link>http://lukas.pokorny.eu/en/sftp-over-websockets/</link><guid isPermaLink="false">1d8b83bc-a992-4f0c-afc4-9fcd554cca67</guid><category><![CDATA[SFTP]]></category><category><![CDATA[WebSockets]]></category><category><![CDATA[Node.js]]></category><dc:creator><![CDATA[Lukas Pokorny]]></dc:creator><pubDate>Sat, 10 Jan 2015 20:46:53 GMT</pubDate><content:encoded><![CDATA[<p>Contrary to common belief, <a href="http://www.sftp.net/">SFTP</a> doesn't stand for <em>"Secure FTP"</em> or <em>"Secure File Transfer Protocol"</em>, but for <em>"SSH File Transfer Protocol"</em>. This is actually a double misnomer:</p>

<ol>
<li>Although SFTP is almost always layered on top of an SSH channel, it could just as well run over any reliable data stream.  </li>
<li>SFTP is not really a <em>file transfer protocol</em>, but rather a <a href="https://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-1">simple remote file system protocol</a>.</li>
</ol>

<p>Because SFTP isn't related to the legacy FTP protocol at all, it doesn't suffer from it's shortcomings - FTP is notoriously firewall-unfriendly due to awkward distinction between control and data connection, and is not well-suited for much more that simple file upload or download.</p>

<p>Given the benefits of SFTP, it's not a surprise that lot of people have been looking for ways to use SFTP to transfer files from a web browser directly to an SFTP server. Some of them already had an SFTP server and wanted to eliminate the need of forcing their customers to install a stand-alone SFTP client, others just wanted to get rid of the nightmare of <a href="http://abandon.ie/notebook/simple-file-uploads-using-jquery-ajax">AJAX-based uploads</a>.</p>

<p><strong>The Past: Black Magic of AJAX</strong></p>

<p>At Rebex, we got numerous questions from those unfortunate people, and we always had to reply that unfortunately, it's impossible to implement a <a href="https://www.rebex.net/sample/sftp-asp-client/default.aspx">web-based SFTP client</a> unless the browser is extended with third-party plugins. And even though it's easily possible to transfer files between the <em>web server</em> and and SFTP server (using a suitable library), the transfer between the web browser and the web server has to be done by HTTP or the black magic of AJAX. Which was the very technology our customers wanted to get rid in most cases...</p>

<p><strong>The Future: SFTP over WebSockets</strong></p>

<p>Fortunately, those sad days will soon be over. Modern web browsers support <em>WebSockets</em>, a technology that makes it possible to open an efficient and persistent packet-based communication session between a web browser application and a web server. Because the SFTP protocol is packet-based as well, it's actually a perfect match. Additionally, the asynchronous nature of the SFTP protocol makes it ideal for the JavaScript environment. When the two protocols are combined, any modern web browser is perfectly capable of communicating <em>directly</em> with any SFTP server that supports <em>SFTP over WebSockets</em>, eliminating the need to use clunky and proprietary AJAX-based solutions.</p>

<p>Of course, there is a catch. SFTP servers only support SFTP over <em>SSH</em> <em>for now</em>, which means they can't be accessed by web browsers <em>directly</em>. I am currently trying to eliminate both of these issues:</p>

<ul>
<li>I'm writing a <a href="https://github.com/lukaaash/sftp-ws">SFTP over WebSockets server package for Node.js</a>. Includes a client as well.</li>
<li>I also plan to write a proxy that adds SFTP over WebSockets support to any server that currently supports SFTP over SSH.</li>
</ul>

<p>So far, everything is looking good. My <em>SFTP/WS</em> server is already working, and a proof-of-concept browser-based SFTP client should be ready soon!</p>

<p>If you are interested in SFTP over WebSockets, please <a href="http://lukas.pokorny.eu/#contact">let me know</a>.</p>]]></content:encoded></item></channel></rss>