If you transfer files to an FTP server frequently using your Linux computer, there is a cool trick you can perform to make things a bit easier for yourself. Using the free tool "curlftpfs" you can easily mount this remote FTP location as a local drive and drag and drop files and folders to it to upload them. The steps involved are pretty straightforward and take just a few minutes. Let's look at how to do this.
If you are using Ubuntu like me, you need to first install curlftpfs before you can begin using it. To install it, execute the command "# sudo apt-get install curlftpfs". On other Linux distributions the step involved in installing curlftpfs may not be too different. Check your distribution's application installer for more information on it.
Once you have curlftpfs installed you need to create a new directory where you will mount your remote server. I like to create this directory under /media where all my devices are usually mounted. So execute the command "# sudo mkdir /media/ftpserver" to create this directory. Now we can proceed to mounting the remote directory. At this point you will need to collect the information required to establish an FTP connection to your remote server. This will usually include an FTP server address, a username, and a password.
The command we will use to mount this server locally will be structured like this:
# sudo curlftpfs -o allow_other ftp://username:password@ftp.yourdomain.com localdir
The actual command to mount your remote server locally would look something like this. Replace "calvin", "h0bb3s", "ftp.cnh.com", and "ftpserver" with the credentials of your own setup.
# sudo curlftpfs -o allow_other ftp://calvin:h0bb3s@ftp.cnh.com ftpserver
Open your file browser and go into the /media/ftpserver folder. You should now be able to see the contents of your remote server. Try copying a file into this folder. You should find that it copies a lot slower than it does when you copy to other folders on your desktop. This is because it is uploading the file to your FTP server.
After you are done playing with this fantastic feature, make sure that you unmount it. To unmount it, you can use the usual unmount command:
# sudo umount /media/ftpserver
If you plan on using this feature often it can get a bit cumbersome to use the above shown command all the time. It might be easier to create an entry in the fstab file, which deals with the mounting of all the devices on your computer. Open the file in your favorite editor using a command like "#sudo vim /etc/fstab" and enter the following in a new line:
curlftpfs#calvin:h0bb3s@ftp.cnh.com /mnt/ftpserver fuse allow_other,rw,user,noauto 0 0
Make sure you enter the credentials for your own server. Save the file and quit the editor. If you are an advanced user you might note that we have not used the noauto option. This is because you might not be connected to the Internet at all times, and mounting it automatically might create some problem sometimes. So the next time you reboot you will need to execute a command to mount the FTP server locally. It is a lot smaller than the command you executed earlier:
# sudo mount /media/ftpserver
NOTE: Please note that you might not want to set this up at a public computer, as the password for your FTP server is visible.
No comments
Post a Comment