fbpx

399€

Diventa Rivenditore

APPBUILDER

Costruisci e Vendi App

Con Il Tuo Logo

Mount remote FTP server as folder on Linux and auto startup it

Sometimes we need to mount the FTP server as a folder on Linux and automatically mount it on reboot. We used this system on a client who needed to back up to an external server. This example is for CentOS 7.

# Installing the CurlFtpFS package (need EPEL repo):
yum install curlftpfs

A few CurlFtpFS command.

# $ftphost = The FTP host
# $mount = Mounted to folder
# $user = FTP username
# $pass = FTP password

# Mount the CurlFtpFS

curlftpfs $ftphost $mount -o user=$user:$pass,allow_other

# Unmount the CurlFtpFS

fusermount -u $mount

Auto mount CurlFtpFS

Creating the startup script:

vi /etc/init.d/mountftp

Copy and paste this. Change the FTP credentials and mounted to folder.

#!/bin/sh
#
# Run-level Startup script for curlftpfs
#
# chkconfig: 345 91 19
# description: Startup/Shutdown the curlftpfs

# FTP user, password, and host (you can specify the port also eg. ftp.example.com:2002)
ftpUser=user
ftpPass=password
ftpHost=ftp.example.com

# Mounted to folder
mPath=”/var/mounted/ftp”

# Create the mounted to dir if doesn’t exist
if [ ! -d $mPath ]; then
mkdir -p $mPath
fi

case “$1” in
start)
curlftpfs $ftpHost $mPath -o user=$ftpUser:$ftpPass,allow_other
;;
stop)
fusermount -u $mPath
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo “Usage: $0 start|stop|restart|reload”
exit 1
esac
exit 0

Make the startup script persistent across reboot.

# chkconfig mountftp on

Available command.

# Start
service mountftp start

# Restart and reload
service mountftp restart
service mountftp reload

# Stop
service mountftp stop

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Questo sito è protetto da reCAPTCHA, ed è soggetto alla Privacy Policy e ai Termini di utilizzo di Google.

Impostazioni sulla privacy salvate!
GDPR Center

When you visit a website, it can store or retrieve information on your browser, mainly in the form of cookies. Check your personal cookie services here.

Questi cookie sono necessari per il funzionamento del sito Web e non possono essere disattivati nei nostri sistemi.

Usiamo WooCommerce come sistema di acquisto. Per l'elaborazione del carrello e dell'ordine verranno memorizzati 2 cookie. Questi cookie sono strettamente necessari e non possono essere disattivati.
  • woocommerce_cart_hash
  • woocommerce_items_in_cart

Rifiuta tutti i servizi
Accetta tutti i servizi

Menu principale