Score:1

Mount external disk via curlftps as a service

us flag

If I have an external drive I access via FTPS, how can I add a systemctl service to mount it and unmount it and have it mount it upon start-up? I already saw some examples with scripts and crontab but I found them too incoherent and hard to deal with.

Score:1
us flag

Create the directory where you'd like to mount the drive

mkdir /mnt/ftp-drive

Create now the file /etc/systemd/system/external-ftp.service with this content (your systemd/system dir might be in a different location):

[Unit]
Description=Mount FTP Space
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/curlftpfs -o ssl,no_verify_peer,nonempty,user=<user>:<pass> <host> /mnt/ftp-drive/ -f -v
ExecStop=/bin/fusermount -u /mnt/ftp-drive

[Install]
WantedBy=multi-user.target

Note the -f option to make curlftps run as daemon. ExecStart and ExecStop need full path of commands, that is, note the full path of curlftps and fusermount. In your case may be different, find the full path with sudo find / -name curlftps -type f.

Now you just start the service

sudo service external-ftp start

if everything is OK, you should be able to access /mnt/ftp-drive and the command sudo service external-ftp status should return OK.

If everything is OK, activate the service to start on boot:

sudo systemctl enable external-ftp
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.