# External File Storage

**URL:** <https://www.ruby-forum.com/t/external-file-storage/125556>\
**Category:** Rails\
**Created:** [January 10, 2008, 3:14am UTC](https://www.ruby-forum.com/t/external-file-storage/125556 "2008-01-10T03:14:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/85f322/32.png) [@jonzo](https://www.ruby-forum.com/u/jonzo)\
**Post date:** [January 10, 2008, 3:14am UTC](https://www.ruby-forum.com/t/external-file-storage/125556/1 "2008-01-10T03:14:32Z")

</div>

Hi there everyone, this might seem like a noob question but…

I’ve got 2 servers: a web hosting server, and a database/storage  
server.

I want to be able to manipulate the files on the storage server  
through my rails app (read/write etc) but they need to be secure so  
they can’t just be in a publicly accessible folder (access determined  
by the rails app). I don’t have much control of the servers  
themselves, so I don’t think I can just hook up a private LAN… it  
has to be done through the net.

What’s the easiest way to do this? I’ve never really had to consider  
it before…

Thanks!  
Jonathan.

---

<div class="post-metadata">

**Author:** ![jonzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/85f322/32.png) [@jonzo](https://www.ruby-forum.com/u/jonzo)\
**Post date:** [January 10, 2008, 3:39am UTC](https://www.ruby-forum.com/t/external-file-storage/125556/2 "2008-01-10T03:39:21Z")

</div>

Jonzo wrote:

> Hi there everyone, this might seem like a noob question but…
> 
> I’ve got 2 servers: a web hosting server, and a database/storage  
> server.
> 
> I want to be able to manipulate the files on the storage server  
> through my rails app (read/write etc) but they need to be secure so  
> they can’t just be in a publicly accessible folder (access determined  
> by the rails app). I don’t have much control of the servers  
> themselves, so I don’t think I can just hook up a private LAN… it  
> has to be done through the net.
> 
> What’s the easiest way to do this? I’ve never really had to consider  
> it before…
> 
> Thanks!  
> Jonathan.

If the storage server has an SSH server, you could use Net::SSH.

[http://net-ssh.rubyforge.org/](http://net-ssh.rubyforge.org/)

---

<div class="post-metadata">

**Author:** ![jonzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/85f322/32.png) [@jonzo](https://www.ruby-forum.com/u/jonzo)\
**Post date:** [January 10, 2008, 3:42am UTC](https://www.ruby-forum.com/t/external-file-storage/125556/3 "2008-01-10T03:42:40Z")

</div>

Thanks 🙂 i’ll take a look

On Jan 10, 3:39 pm, Jeremy Weiskotten \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![jonzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/85f322/32.png) [@jonzo](https://www.ruby-forum.com/u/jonzo)\
**Post date:** [January 10, 2008, 4:14am UTC](https://www.ruby-forum.com/t/external-file-storage/125556/4 "2008-01-10T04:14:14Z")

</div>

Hi I had a look at that, and to be honest, I’m not too familiar with  
how to share files over ssh… sftp maybe…

Maybe I’m a bit delusional, but I’m thinking this must be a more  
common problem with a more documented solution surely?

I’ve seen people talking about hosting rails on multiple ec2 instances  
a lot, how do people share uploaded images between web-server  
instances? am I missing something?

Jonathan.

---

<div class="post-metadata">

**Author:** ![jonzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/85f322/32.png) [@jonzo](https://www.ruby-forum.com/u/jonzo)\
**Post date:** [January 10, 2008, 5:09am UTC](https://www.ruby-forum.com/t/external-file-storage/125556/5 "2008-01-10T05:09:10Z")

</div>

Hi,

There isn’t a magic ‘share files’ button to find. You need some way to  
do it, as Jeremy mentioned one way to do it is with ssh between the  
servers.

From what you say, (accessing uploaded images?) what you want is a  
network file system, like for example NFS (there are dozens of  
different ones all with pros and cons - like NFS traditionally causes  
big problems when trying to write to the same file from multiple  
places since it’s locking isn’t too good, though is always getting  
better).

That way, you can set up the filesystem from the ‘server’ machine  
which can be mounted by the ‘client’. So accessing shared files is  
essentially going to a specific directory on the client (where the  
file system is mounted).

Then you need to look at other things, like if you don’t have a  
private/internal network then you need some iptables rules to only  
allow your client to talk to the network filesystem (to stop nasty  
people doing naughty things to it :).

Probably some network filesystem research will get you where you want to  
go.

Good luck, HTH.

Malcolm.

---

<div class="post-metadata">

**Author:** ![jonzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/85f322/32.png) [@jonzo](https://www.ruby-forum.com/u/jonzo)\
**Post date:** [January 10, 2008, 5:12am UTC](https://www.ruby-forum.com/t/external-file-storage/125556/6 "2008-01-10T05:12:41Z")

</div>

Thanks for that! I think you’re completely right about the network  
file system. I’ve read about them before but I didn’t think of it at  
all. Thanks heaps everyone!

---

<div class="post-metadata">

**Author:** ![jonzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/85f322/32.png) [@jonzo](https://www.ruby-forum.com/u/jonzo)\
**Post date:** [January 10, 2008, 5:10am UTC](https://www.ruby-forum.com/t/external-file-storage/125556/7 "2008-01-10T05:10:47Z")

</div>

Jonzo wrote:

> Hi I had a look at that, and to be honest, I’m not too familiar with  
> how to share files over ssh… sftp maybe…
> 
> Maybe I’m a bit delusional, but I’m thinking this must be a more  
> common problem with a more documented solution surely?
> 
> I’ve seen people talking about hosting rails on multiple ec2 instances  
> a lot, how do people share uploaded images between web-server  
> instances? am I missing something?
> 
> Jonathan.

Well, you could use S3. Maybe that’s what you’re talking about. EC2 is a  
compute cloud. S3 is the Amazon Simple Storage Service. You could use  
that – I think it’s secure. There is a Ruby API for it.

> **[Cloud Object Storage – Amazon S3 – Amazon Web Services](https://aws.amazon.com/s3/)**
>
> Amazon S3 is cloud object storage with industry-leading scalability, data availability, security, and performance. S3 is ideal for data lakes, mobile applications, backup and restore, archival, IoT devices, ML, AI, and analytics.

---

<div class="post-metadata">

**Author:** ![jonzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/85f322/32.png) [@jonzo](https://www.ruby-forum.com/u/jonzo)\
**Post date:** [January 10, 2008, 5:18am UTC](https://www.ruby-forum.com/t/external-file-storage/125556/8 "2008-01-10T05:18:31Z")

</div>

Another possibility could be to setup a VPN I guess, what’s the  
general opinion out there about this option?
