A FTP filesystem implementation in Rust that allows you to mount FTP servers as local directories, similar to the curlftpfs utility.
- Mount FTP servers as local filesystems using FUSE
- Support for FTP over TLS/SSL (FTPS)
- Read and write file operations
- Directory listing and navigation
- Create, delete, and rename files and directories
- Automatic reconnection on connection failures
- Configurable mount options
- Cross-platform support (Linux, macOS, FreeBSD)
- Rust 1.70 or later
- FUSE development libraries
Ubuntu/Debian:
sudo apt-get install libfuse3-dev pkg-configCentOS/RHEL/Fedora:
sudo yum install fuse-devel pkgconfig
# or for newer systems:
sudo dnf install fuse-devel pkgconf-pkg-configmacOS:
brew install macfuse pkgconfFreeBSD:
pkg install fusefs-libs pkgconfgit clone https://github.com/yourusername/rustftpfs.git
cd rustftpfs
cargo build --releaseThe binary will be available at target/release/rustftpfs.
Mount an FTP server:
rustftpfs ftp://username:password@ftp.example.com /mnt/ftpMount with explicit credentials:
rustftpfs ftp://ftp.example.com /mnt/ftp --user myuser --password mypassMount with custom port:
rustftpfs ftp://ftp.example.com:2121 /mnt/ftp --user myuser --password mypassUsage: rustftpfs [OPTIONS] <FTP_URL> <MOUNTPOINT>
Arguments:
<FTP_URL> FTP URL in format ftp://[user[:password]@]host[:port][/path]
<MOUNTPOINT> Local directory to mount the FTP filesystem
Options:
-u, --user <USERNAME> Username for FTP authentication
-p, --password <PASSWORD> Password for FTP authentication
-P, --port <PORT> FTP port (default: 21)
--tls Use TLS/SSL encryption
-r, --read-only Mount filesystem as read-only
-f, --foreground Run in foreground mode
-d, --debug Enable debug output
--allow-other Allow other users to access the mount
--uid <UID> Set file owner UID
--gid <GID> Set file group GID
--umask <UMASK> Set file permissions umask
-h, --help Print help information
-V, --version Print version information
-r, --read-only: Mount the filesystem in read-only mode-f, --foreground: Run the program in foreground (don't daemonize)-d, --debug: Enable debug logging--allow-other: Allow other users to access the mounted filesystem--tls: Use TLS/SSL encryption for FTP connection
rustftpfs --read-only ftp://ftp.gnu.org /mnt/gnurustftpfs --tls ftp://secure.example.com /mnt/secureftp --user myuserrustftpfs --allow-other ftp://ftp.example.com /mnt/ftp --user myuserrustftpfs --foreground --debug ftp://ftp.example.com /mnt/ftp --user myuserTo unmount the filesystem:
fusermount -u /mnt/ftp
# or
umount /mnt/ftpRUST_LOG: Set logging level (e.g.,RUST_LOG=debug)
The project consists of two main modules:
- ftp.rs: Handles FTP connections and operations using the
suppaftpcrate - filesystem.rs: Implements the FUSE filesystem interface using the
fusercrate
FtpConnection: Manages FTP connections with automatic reconnectionFtpFs: Implements the FUSE filesystem operations- Inode management for tracking files and directories
- Read caching for improved performance
| Feature | RustFTPFS | curlftpfs |
|---|---|---|
| Language | Rust | C |
| FTP Library | suppaftp | libcurl |
| FUSE Library | fuser | libfuse |
| TLS Support | Yes | Yes |
| Auto-reconnect | Yes | Yes |
| Proxy Support | Planned | Yes |
| Symlinks | Basic | Advanced |
| Performance | Good | Good |
| Memory Safety | High | Medium |
rustftpfs/
├── src/
│ ├── main.rs # CLI and entry point
│ ├── lib.rs # Library exports
│ ├── ftp.rs # FTP connection handling
│ └── filesystem.rs # FUSE filesystem implementation
├── Cargo.toml # Dependencies and metadata
└── README.md # This file
cargo test- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the curlftpfs project
- Built with fuser and suppaftp crates
- Thanks to all contributors to the Rust FUSE ecosystem
If you get permission errors:
- Make sure you're in the
fusegroup:sudo usermod -a -G fuse $USER - Log out and log back in
- Check mountpoint permissions
- Verify FTP server address and credentials
- Check if TLS is required by the server
- Try using passive mode (default behavior)
- Ensure the mountpoint directory exists
- Check if the directory is already mounted
- Verify FUSE is installed and working:
lsmod | grep fuse
This program uses unsafe code only for:
- Getting current user ID and group ID
- FUSE filesystem operations (through the fuser crate)
The core FTP and filesystem logic is implemented in safe Rust.# RustFtpFS