April 24, 2010 · General · Email This Post

Sponsored Link
This tutorial will explain how to mount ftp folder to local directory in Ubuntu.We have to use Curlftpfs for this purpose.CurlFtpFS is a filesystem for accessing FTP hosts based on FUSE and libcurl.
Features

CurlFtpFS differentiates itself from other FTP filesystems because it features:

* SSLv3 and TLSv1 support
* connecting through tunneling HTTP proxies
* automatically reconnection if the server times out
* transform absolute symlinks to point back into the ftp file system

Install CurlFtpFS in Ubuntu

sudo aptitude install curlftpfs

Now you need to edit fstab file and configure the following command

gksudo gedit /etc/fstab

Add the following line

curlftpfs#ftpUsername:ftpPassword@ftp://ftpUrl /localDirectory fuse rw,uid=1000,umask=0777,user,suid,allow_other,exec,auto,utf8  0   1

Save and exit

Now you need to run the following command from your terminal

mount -a

You also need to edit /etc/rc.local file this is because every time you boot you need to make sure your ftp folder is mounted properly

gksudo gedit /etc/rc.local

Add this just before the "exit 0″ line

sudo curlftpfs -o umask=0777,uid=1000,gid=1000,allow_other ftp://username:[email protected] /localdirectory

Save and exit

Now you need to run the following command from your terminal

mount -a

Sponsored Link

Incoming search terms:

Related posts

18 Comments to “How to mount ftp folder to local directory in Ubuntu”

  1. fnf says:

    You may use Nautilus+gvfs for the same functionality, and many more. Navigate to File->Connect to Server to choose from a number of options (SSH, Windows share, FTP, etc.) .

    [Reply]

  2. martijnvanes says:

    Hi, I tried to set this up for my sftp server and it looks like CurlFtpFS doesnt work with SFTP. Am I doing something wrong or ???? Thanx for your answer.

    [Reply]

  3. Michael says:

    Your solution presupposes that the user wishes to have the ftp directory constantly mounted (and that he has root access). This will not always be the case. Further, if he is on a shared or exposed system, putting passwords in public files is very dangerous.

    Consider, instead, “curlftpfs ftp://remote [local]”, which temporarily mounts [remote] on [local] with one commando. (See “man curlftpfs” for details, options, passwords.)

    [Reply]

  4. g says:

    huh ?
    very strange…

    If i use FileZila, i can connect.
    But if i use ur step mentioned above…
    It said that can not resolve host.

    HUH?
    what’s the cause eh? did i put something wrong?

    [Reply]

  5. Vino says:

    Hi,
    I search a solution for mount a HTTP folder (no FTP access)

    Howcan do that ?

    [Reply]

  6. Fred says:

    Hi. . . the file setup works fantastic.

    Just one problem. . . when booting up, I get this error message on the Ubuntu (version 10.04) welcome screen:

    An error occurred while mounting /*localfolder*
    Press S to skip mounting or M or manual recovery.

    Once I skip the mounting, everything works normally. Is there a way to get Ubuntu to bypass this error message (that is, continue with its reboot)?

    Thanks!

    [Reply]

  7. Eugen says:

    @Fred: i guess you just copy-paste the example above because the “localfolder” is just a generic name for what would be your custom local folder on your ftp server. So if you want to map directly the root folder of your ftp server (instead other sub-directory, such as “your_local_folder_here”) then you can simply use “/” instead of “localfolder”.

    I’m not expert neither advanced user, it is just my 5 cents ;o)

    [Reply]

  8. Eugen says:

    @Fred & @myself:

    “localfolder” is the generic name for local folder on your local computer (otherwise in the example above they would call it “remotefolder”).

    So, let’s suppose you have on your own laptop/desktop a folder in root which is called /mnt.

    A simple working example would be:

    sudo curlftpfs -o umask=0777,uid=1000,gid=1000,allow_other ftp://fred_user_name:fred_password_here@your_ftp_ip_or_address /mnt

    Here /mnt stand for the local point where you can find all the remote content (such ftp files/folders).

    After running the command above just list the /mnt content with:

    ls /mnt

    You should be able to see all files/folders which exists on your ftp server on the local folder /mnt.

    I hope that you will succeed in your try&error :o)

    [Reply]

  9. JohnyO says:

    How to enter a username in fstab which has @ symbol? Like

    [email protected]:mypass@ftp://ftp.mysite.com /mnt/somedir

    [Reply]

    JohnyO Reply:

    A typo. The command should be

    [email protected]:mypass@ftp://ftp.mysite.com /mnt/somedir

    escaping @ does not work as well

    curlftpfs#myself\100myself.com:mypass@ftp://ftp.mysite.com /mnt/somedir

    [Reply]

  10. Eugen says:

    @JohnyO:

    Use %40 instead of @ or \100.

    [Reply]

  11. root says:

    “ftp://url/dir” doesn`t work for me.
    (Error connecting to ftp: Couldn’t resolve host ‘ftp’) Use “url/dir” instead.

    [Reply]

  12. Jeremy says:

    Tried this as well and keep getting access denied 530. But the password and user are the same as entered in filezilla and it works there…any suggestions?

    [Reply]

    Mesi Reply:

    just remove ftp://

    curlftpfs#user:password@host /localDir …….

    [Reply]

  13. Ewerton says:

    “Tried this as well and keep getting access denied 530. But the password and user are the same as entered in filezilla and it works there…any suggestions?”

    To fix that, put “%40″ instead of “@” in the username, example:
    if your username is [email protected]
    put this in the command:

    curlftpfs my_user%40myhost.com:[email protected] /mnt/point

    if you put only “my_user” it will give access denied.

    [Reply]

  14. osirisgothra says:

    Hello All,

    Michael’s Post about doing it in one command: perfect. I was about to pull out my hair with all the unnecisary dinking around in rc.conf and fstab…. thanks Michael, your method was far better than the main one presented–and in one command (and a simple one at that) I had it up and running perfectly! :)

    [Reply]

  15. Michael says:

    mount: mount point fuse does not exist

    – this is the error I keep getting. Does anybody know why I’m getting this error?

    [Reply]

  16. Ben V. says:

    Thanks a lot!

    [Reply]

Leave a Reply