# File.open to open Remotely

**URL:** <https://www.ruby-forum.com/t/file-open-to-open-remotely/178743>\
**Category:** Rails\
**Created:** [November 10, 2009, 3:58pm UTC](https://www.ruby-forum.com/t/file-open-to-open-remotely/178743 "2009-11-10T15:58:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mishoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3e96dc/32.png) [@mishoo](https://www.ruby-forum.com/u/mishoo)\
**Post date:** [November 10, 2009, 3:58pm UTC](https://www.ruby-forum.com/t/file-open-to-open-remotely/178743/1 "2009-11-10T15:58:59Z")

</div>

I know that this question looks like a Webistrano question but since I  
donâ€™t know much about Ruby, I thought it might be a simple Ruby question  
too.  
We have installed Webistrano and Capistrano install on some server  
(letâ€™s say Server1). I have created a Webistrano project and inside it I  
have defined my Host to be â€˜Server2â€™. I have this Ruby code inside my  
project:  
require ‘open-uri’  
writeout = open("/home/test/test.txt", “wb”)  
writeout.write(â€œTESTâ€)  
writeout.close

The problem is Webistrano is giving me an error saying that  
/home/test/test.txt does not exist. I believe what Itâ€™s trying to do is  
to create test.txt in Server1 (Capistrano Server) instead of my defined  
Host.  
Is there any way in Ruby to say Open the file remotely (e.g.  
â€œServer2:/home/test/test.txtâ€) (assuming there is no Server of any kind  
installed on Server2).  
Strange is if I have a command like run “bash --login -c ‘touch  
test.txt’”, it will create test.txt in the right defined Host (Server2).  
But â€˜openâ€™ somehow is failing.

Thanks in Advance,

Homer
