ArchLinux 2018.10.01: Install curlftpfs for FTP client


Table of Contents

1 Install curlftpfs

Install curlftpfs package.

$ sudo pacman -Sy –noconfirm curlftpfs

2 Mount FTP with curlftpfs

Mount FTP with curlftpfs to mnt directory.

$ FTP_SERVER=ftp-server.hiroom2.com$ FTP_USERNAME=foobar$ FTP_PASSWORD=foobar$ mkdir mnt$ curlftpfs -o user=${FTP_USERNAME} “${FTP_SERVER}” mntEnter host password for user ‘${FTP_USERNME}’:

You can set password with user=<username>:<password>.

$ curlftpfs -o user=${FTP_USERNAME}:${FTP_PASSWORD} “${FTP_SERVER}” mnt

The password in ~/.netrc will be used with user=<username>:.

$ cat <<EOF > ~/.netrcmachine ${FTP_SERVER}login ${FTP_USERNAME}password ${FTP_PASSWORD}EOF$ chmod 600 ~/.netrc$ curlftpfs -o user=${FTP_USERNAME}: “${FTP_SERVER}” mnt

If not specifying user, you will connect as anonymous user.

$ curlftpfs “${FTP_SERVER}” mnt

The allow_other allows access from other user. The allow_root allows access from root user. If not specifying allow_other and allow_root, mount point can be accessed by only user which runs mount.

$ curlftpfs -o user=${FTP_USERNAME},allow_other “${FTP_SERVER}” mnt

3 Mount FTP on boot

Add mount entry to /etc/fstab. For avoiding mounting FTP before network initialization, you need to add _netdev option. For making x-systemd.automount to mount FTP, you need to add x-systemd.automount to option.

$ OPT=_netdev,x-systemd.automount,allow_other$ cat <<EOF | sudo tee -a /etc/fstabcurlftpfs#${FTP_USERNAME}:${FTP_PASSWORD}@${FTP_SERVER} /mnt fuse ${OPT} 0 0EOF

Creating .netrc in /root can omit password.

$ cat <<EOF | sudo tee /root/.netrcmachine ${FTP_SERVER}login ${FTP_USERNAME}password ${FTP_PASSWORD}EOF$ sudo chmod 600 /root/.netrc$ echo “curlftpfs#${FTP_USERNAME}:@${FTP_SERVER} /mnt fuse ${OPT} 0 0” | sudo tee -a /etc/fstab

Android | Linux | SDL - Narrow Escape