1. Installation |
2. Mount ftp directory |
3. Mount ftp with curlftpfs using /etc/fstab |
You can make your access to your ftp resource easier with curlftpfs linux utility. This fantastic utility allows you to mount your ftp site to any directory withing your linux filesystem.
1. Installation
First install curlftpfs package. On Debian or Ubuntu it would simple as:apt-get install curlftpfs
2. Mount ftp directory
What needs to be done next is to create a mount point:# mkdir /mnt/my_ftpnext use curlftpfs to mount your remote ftp site. Suppose my access credentials are as follows:
- username: ftp-user
- password: ftp-pass
- host/IP: my-ftp-location.local
# curlftpfs ftp-user:ftp-pass@my-ftp-location.local /mnt/my_ftp/
Caution:ftp uses unencrypted passwords so anyone can intercept your password without much effort. Therefore use curlftpfs in combination with SSL certificates if your are not mounting some local LAN ftp server.
On Debian you can mount ftp using curlftpfs as a root and this allows only root user to access ftp mount. No other users are allowed since by default only users that mounts has and access to mount directory. When mounting ftp as a non-root user you may get a following error message:
fuse: failed to open /dev/fuse: Permission deniedRather that changing permissions of /dev/fuse you can allow other users to access ftp mount directory with an curlftpfs's option allow_other. The command will look similar to the one below:
# curlftpfs -o allow_other ftp-user:ftp-pass@my-ftp-location.local /mnt/my_ftp/
3. Mount ftp with curlftpfs using /etc/fstab
Since we do not want put any passwords to /etc/fstab file we will first create a /root/.netrc file with a ftp username and password using this format:machine my-ftp-location.local login ftp-user password ftp-passNow change permissions of this file to 600:
# chmod 600 /root/.netrcCheck uid and gid of your non-root user. This user will have a access to ftp mount directory:
$ idIn the next step add a following line to your /etc/fstab file ( change credentials for your ftp user ):
curlftpfs#my-ftp-location.local /mnt/my_ftp fuse allow_other,uid=1000,gid=1000,umask=0022 0 0
Now mount ftp with:mount -a