Mount FTP Site as Folder
Mount FTP Site as Folder
Mounting FTP Sites as Local Directories
You can mount an FTP site as a local directory in Linux using curlftpfs
, allowing you to interact with remote FTP content as if it were on your local filesystem.
Installation
First, install the required package:
1
sudo apt-get install curlftpfs
For other distributions:
1
2
3
4
5
# For Fedora/RHEL/CentOS
sudo dnf install curlftpfs
# For Arch Linux
sudo pacman -S curlftpfs
Basic Usage
Mount an FTP site to a local directory:
1
curlftpfs ftp://user:password@example.com /mnt/ftp_mounted
Prerequisites
Ensure your mount point exists:
1
2
# Create the mount point if it doesn't exist
sudo mkdir -p /mnt/ftp_mounted
Advanced Options
Mount with Specific Permissions
1
curlftpfs -o uid=1000,gid=1000 ftp://user:password@example.com /mnt/ftp_mounted
Connect to a Specific Port
1
curlftpfs ftp://user:password@example.com:2121 /mnt/ftp_mounted
Use SSL/TLS (FTPS)
1
curlftpfs -o ssl ftp://user:password@example.com /mnt/ftp_mounted
Unmounting
When you’re done, unmount the FTP site:
1
fusermount -u /mnt/ftp_mounted
Automounting at Boot
To automatically mount at boot time, add to /etc/fstab
:
1
curlftpfs#ftp://user:password@example.com /mnt/ftp_mounted fuse rw,uid=1000,gid=1000,allow_other,_netdev 0 0
Security Note: Storing passwords in plain text in
/etc/fstab
is not recommended for sensitive systems. Consider using a credentials file with restricted permissions instead.
This post is licensed under
CC BY 4.0
by the author.