在Ubuntu上备份FTP数据,你可以使用多种方法。以下是一些常见的步骤和方法:
wget
或curl
安装必要的工具:
sudo apt update
sudo apt install wget curl
备份单个文件或目录:
wget
:wget --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --domains example.com --no-parent ftp://ftp.example.com/path/to/backup
curl
:curl -O ftp://ftp.example.com/path/to/file_or_directory
备份整个FTP站点:
你可以使用wget
的递归选项来备份整个FTP站点:
wget --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --domains example.com --no-parent ftp://ftp.example.com/
lftp
安装lftp
:
sudo apt update
sudo apt install lftp
备份单个文件或目录:
lftp -e 'mirror --reverse --delete --verbose /path/to/local/backup ftp://ftp.example.com/path/to/remote; quit' -u username,password
备份整个FTP站点:
lftp -e 'mirror --reverse --delete --verbose /path/to/local/backup ftp://ftp.example.com/; quit' -u username,password
rsync
安装rsync
:
sudo apt update
sudo apt install rsync
备份单个文件或目录:
rsync -avz --progress -e ssh username@ftp.example.com:/path/to/remote /path/to/local/backup
备份整个FTP站点:
由于rsync
不直接支持FTP,你需要先通过SSH隧道连接到FTP服务器,然后使用rsync
进行备份。这通常需要你在FTP服务器上设置SSH访问权限。
通过以上方法,你可以在Ubuntu上有效地备份FTP数据。选择适合你需求的方法进行操作即可。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
相关推荐:如何在Ubuntu上备份FTP服务器数据