vsFTPd 表明 Very Secure File Transfer Protocol Daemon (很是安全的文件傳輸協議守護進程)。它是一個用於 Unix 和 Linux 操做系統的開源、輕量、穩定、最安全和最快的 FTP 服務器。
一些流行的FTP站點的Debian,FreeBSD,RED HAT,SUSE,Kernel,KDE,GENOME等,就是基於VSFTPD。
它是大多數Linux和Unix操做系統(例如Red Hat,CentOS,Fedora和Ubuntu)的默認FTP服務器。
它支持IPv6和SSL。所以,您可使用VSFTPD爲您的組織設置安全的FTP服務器。它是根據GPL許可的,徹底免費。html
root@mail:/# apt-get update root@mail:/# apt-get upgrade
root@mail:/# apt-get install vsftpd
備份下配置文件linux
root@mail:/# cp /etc/vsftpd.conf /etc/vsftpd.conf.backup
使用 nano 打開 vsftpd.confweb
root@mail:/# nano /etc/vsftpd.conf
使用CTRL+W
搜索並修改如下配置項:ubuntu
anonymous_enable=NO local_enable=YES write_enable=YES allow_writeable_chroot=YES chroot_local_user=YES file_open_mode=0777 local_umask=022
若是存在則取消註釋,不然添加行。安全
userlist_deny=NO userlist_enable=YES userlist_file=/etc/vsftpd.allowed_users
sudo touch /etc/vsftpd.allowed_users
該文件包含了能夠訪問的用戶名:bash
m.slavov yourSECONDuser yourTHIRDuser
若是你想的話還能夠作一些高級配置:服務器
#Useful to not write over hidden files: force_dot_files=YES #Hide the info about the owner (user and group) of the files. hide_ids=YES #Maximum number of clients: max_clients=20 #Connection limit for each IP: max_per_ip=2 #Chnage listen port from 21 to other listen_port=999
這點很重要,由於你可以限制這個用戶只能訪問一個目錄。你能夠容許它訪問/var/www
下的全部站點或只能訪問其中某一個站點。
例如,若是你想建立用戶ftp
並只容許它訪問一個站點,輸入如下命令,而且不要忘了在/etc/vsftpd.allowed_users
中添加這個用戶:ide
root@mail:/# adduser ftp root@mail:/# usermod –home /var/www/YOURFOLDERSITE ftp
或者打開文件/etc/passwd
,而後搜索你想改變家目錄的用戶,把/home/ftpuser
修改成/var/www
:操作系統
root@mail:/# nano /etc/passwd root@mail:/# ftpuser:x:1001:1001:FTP USER,,,:/var/www:/bin/bash
爲了使修改生效,你必須重啓vsFTPd服務。命令行
root@mail:/# systemctl restart vsftpd
如今當用戶經過 ftpzilla 鏈接 ftp,只能看到一個站點。
若是你想看到命令的輸出,用命令/etc/init.d/vsftpd restart
。
顯示vsFTPd狀態,用命令:systemctl status vsftpd
若是你想全部用戶都有權限寫入到這個文件夾,你必須設置所有權限777。
若是你只想某個組有權限寫入、其餘用戶只能讀,你就得設置權限爲775.
root@mail:/# chmod 777 -R /var/www/YOURFOLDERSITE root@mail:/# chown ftp:ftp -R /var/www/YOURFOLDERSITE
新建鏈接,輸入 ip 地址和剛纔新建的 ftp 用戶以及密碼。
這裏我遇到一個問題:
在命令行用
ftp
命令能夠鏈接到 ftp 服務器,可是用 Xftp 鏈接卻老是提示「沒法顯示遠程文件夾」。
解決:
在「會話屬性」的「選項」窗口,勾掉「使用被動模式」,重試。
參考:
http://linux-sys-adm.com/ubuntu-16.04-lts-how-to-install-and-configure-vsftpd-on-ubuntu/
https://www.ostechnix.com/install-vsftpd-server-ubuntu-16-04-lts/