title: How to transfer data into remote file over SFTP without storing data in a local file in Linux Bash?
body: <p>I need to be able to transfer data from memory into a remote file through SFTP. I originally had this working through SSH, and while working, discovered that I don't have SSH access to the remote location, only SFTP access.</p>
  
  
  
  <p>Here is an example of the original SSH code I had:</p>
  
  <pre class="lang-bash prettyprint-override"><code>echo "secret_data" | ssh root@localhost cat &gt; secret_file;
  </code></pre>
  
  <p>This is exactly what I need, but in some kind of form of:</p>
  
  <pre class="lang-bash prettyprint-override"><code>sftp root@localhost put $secret_data secret_file;
  </code></pre>
  
  <p>In principal, I need the data to never be stored on a file on the local machine, and dealt with entirely from memory.</p>
  
  <p>Any replies appreciated. Thanks.</p>