How can I configure Rails to connect to a database via SSH? In the config file we have: development: adapter: database: username: password: host: No connection type, ssh port... Thank you, Alvaro. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 27 Jul 2007, at 13:02, Alvaro Perez wrote:> How can I configure Rails to connect to a database via SSH? In the > config file we have: > > development: > adapter: > database: > username: > password: > host: > > No connection type, ssh port...Why don''t you use ssh port forwarding or a reverse ssh tunnel (depending on your needs). Make sure the tunnel is created at startup. Reverse SSH tunneling can be a very interesting solution if the target server is behind a firewall. I''m using autossh to tunnel some of our customers'' pcs to our server and it works just great (autossh will restore the ssh tunnel if the connection drops etc.). You can then just connect to 127.0.0.1 on a port of your preference. Lots of articles on ssh port forwarding around the net: http:// www.google.com/search?client=safari&rls=en&q=ssh+port +forwarding&ie=UTF-8&oe=UTF-8 Reverse ssh tunneling: http://www.google.com/search? client=safari&rls=en&q=reverse+ssh+tunneling+autossh&ie=UTF-8&oe=UTF-8 Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Peter, I''ve used Putty (as I''m on a Windows machine) to create a SSH tunnel and it works very fine. Thank you very much for thye idea. Regards, Alvaro Peter De Berdt wrote:> On 27 Jul 2007, at 13:02, Alvaro Perez wrote: > >> No connection type, ssh port... > Why don''t you use ssh port forwarding or a reverse ssh tunnel > (depending on your needs). Make sure the tunnel is created at startup. > > Reverse SSH tunneling can be a very interesting solution if the > target server is behind a firewall. I''m using autossh to tunnel some > of our customers'' pcs to our server and it works just great (autossh > will restore the ssh tunnel if the connection drops etc.). > > You can then just connect to 127.0.0.1 on a port of your preference. > > Lots of articles on ssh port forwarding around the net: http:// > www.google.com/search?client=safari&rls=en&q=ssh+port > +forwarding&ie=UTF-8&oe=UTF-8 > Reverse ssh tunneling: http://www.google.com/search? > client=safari&rls=en&q=reverse+ssh+tunneling+autossh&ie=UTF-8&oe=UTF-8 > > > Best regards > > Peter De Berdt-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Alvaro Perez wrote:> How can I configure Rails to connect to a database via SSH? In the > config file we have: > > development: > adapter: > database: > username: > password: > host: > > No connection type, ssh port... > > Thank you, > Alvaro.Do you mean a SSH Tunnel? * http://docs.planetargon.com/PostgreSQL_SSH_Tunnel * http://docs.planetargon.com/MySQL_SSH_Tunnel Good luck! Robby -- Robby Russell http://www.robbyonrails.com/ http://www.planetargon.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Yep, exactly that. Thanks! Robby Russell wrote:> Alvaro Perez wrote: >> No connection type, ssh port... >> >> Thank you, >> Alvaro. > > Do you mean a SSH Tunnel? > > * http://docs.planetargon.com/PostgreSQL_SSH_Tunnel > * http://docs.planetargon.com/MySQL_SSH_Tunnel > > Good luck! > > Robby > > > -- > Robby Russell > http://www.robbyonrails.com/ > http://www.planetargon.com/-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
What database are you using? If possible I would try to use a native secure link such as ssl with authentication, much more efficient. Postgresql for example can use ssl with client authentication. Not sure about mysql. Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---