Mounting an FTP server as a local drive


Loonie

Active Member
Joined
Apr 1, 2003
Messages
753
Hey guys,

Is there actually a way to mount an FTP server as a drive on Pandora? I've just set up a NAS and configured it to run an FTP server so non-windows devices can access it. I can use FileZilla from the Pandora repo to transfer files to and from the NAS, but I want to be able to stream files from it rather than have to download them completely before being able to play them.

Anyone got any ideas?

Cheers
 
If you have sftp or ssh then try: sshfs -h

If you have ftp then try: curlftpfs

This worked for me *(just checked)*


# Become root
sudo su
# make a mountpoint, which is accessible by also your user
mkdir /media/disk
chmod 777 /media/disk
exit
# as your user, mount the ftp as a disk
curlftpfs ftp://user:password@remoteipadress /media/disk

or check: opkg list |grep ftpfs

edit2: for completeness, you do not need to become root, just make a directory anywhere (but /media is a good place, really). And sshfs works to connect to your homedir of your linux box.
 
Last edited by a moderator:
If you have sftp or ssh then try: sshfs -h


If you have ftp then try: curlftpfs


This worked for me *(just checked)*

# Become root
sudo su
# make a mountpoint, which is accessible by also your user
mkdir /media/disk
chmod 777 /media/disk
exit
# as your user, mount the ftp as a disk
curlftpfs ftp://user:password@remoteipadress /media/disk
or check: opkg list |grep ftpfs

edit2: for completeness, you do not need to become root, just make a directory anywhere (but /media is a good place, really). And sshfs works to connect to your homedir of your linux box.
Holy crap I have to do this now! Thats such a good idea. Does it stay mounted after a reboot?
 
You will have to add the mountpoint to /etc/fstab to make it mount on boot.
 
https://wiki.archlinux.org/index.php/NetworkManager#Network_services_with_NetworkManager_dispatcher

You can also write a small script that will auto mount/unmount when the network connection is started/stopped:

/etc/NetworkManager/dispatcher.d/

The script requires a bit of work, for example, to test if you are connected to your home computer through a tcpip cable, something like playing with:

$CONNECTION_UUID  (probably the router ID)

and ifconfig |grep wlan0 |grep $MYMACADRESS (or something here to know your remote-peer address (or configure your router to give your server a fixed IP adress)

to detect if you are save to go...

(sorry, too lazy to write a good testcase, but I tested a minimal script and it works on the Pandora)


echo $1 $2 $CONNECTION_UUID >> /home/me/nm.log

It writes things to the logfile, and, combined with the right code, should be able to work just fine. There was no need for me to restart the network manager. Just the menu to ifupdown my connection.

Oh, and to unmount:

fusermount -u /media/disk
 
Last edited by a moderator:
Whoa, thanks FBNil. That worked so well, I ended up deleting every file on my NAS. :D

I created a test directory on the desktop and curlftpfs'd the NAS to it. All worked well, so I went "Cool, I'll just delete the test directory and I'll ma- oh wait, no, that will - no, don't... oh. Poop."

Luckily I had just picked the thing up and configured it yesterday, so I hadn't had time to put much on it. Windows has made me stupid! I must exercise more caution.

Anyhow, that worked a treat. Thanks.
 
ouch! Sorry to hear that, all that work of filling the NAS for nothing.

You can configure it to be a readonly directory though...

edit:  tried -o defer_permissions but that did not work, so I guess a readonly ftp account could do the trick...
 
Last edited by a moderator:
Ah well, not to worry, there wasn't anything too important on there. Better to get the stupidity out of the way early on.
 
Ah well, not to worry, there wasn't anything too important on there. Better to get the stupidity out of the way early on.
Computers - good ones anyway - do exactly what you tell them to.  My biggest gripe with Microsoft stuff is all the things they try to do that I didn't ask them to.
 
Back
Top