# SFTP with ruby cgi-bin

**URL:** <https://rubytalk.org/t/sftp-with-ruby-cgi-bin/52706>\
**Category:** ruby-talk\
**Created:** [6 April 2009 15:12 UTC](https://rubytalk.org/t/sftp-with-ruby-cgi-bin/52706 "2009-04-06T15:12:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Thorp](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Andrew\_Thorp](https://rubytalk.org/u/Andrew_Thorp)\
**Post date:** [6 April 2009 15:12 UTC](https://rubytalk.org/t/sftp-with-ruby-cgi-bin/52706/1 "2009-04-06T15:12:04Z")

</div>

When I execute the ruby manually, it works great.

When I run it over http, no cake.

Basically, when I run the ruby it will connect to sftp and have no  
problems, but when I navigate to the cgi-bin through my browser, I get  
this error:

!ruby/exception:Net::SSH::AuthenticationFailed

Please somebody help

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Mark\_Thomas](https://avatars.discourse-cdn.com/v4/letter/m/b5a626/32.png) [@Mark\_Thomas](https://rubytalk.org/u/Mark_Thomas)\
**Post date:** [8 April 2009 11:55 UTC](https://rubytalk.org/t/sftp-with-ruby-cgi-bin/52706/2 "2009-04-08T11:55:04Z")

</div>

A CGI app is run as the web server user. So you'll need to make sure  
the web server user can connect. Try logging in as the web server user  
and establish the keys necessary to perform the SSH.

> **···**
>
> On Apr 6, 11:12 am, Andrew Thorp \<and...@gladhandle.com\> wrote:
> 
> > When I execute the ruby manually, it works great.
> > 
> > When I run it over http, no cake.
> > 
> > Basically, when I run the ruby it will connect to sftp and have no  
> > problems, but when I navigate to the cgi-bin through my browser, I get  
> > this error:
> > 
> > !ruby/exception:Net::SSH::AuthenticationFailed
