天天看點

Centos7下VSFTPD服務的安裝配置安裝VSFTPD配置VSFTPD使用FileZilla連接配接

本次實踐使用百度伺服器 CentOS / 7.1 x86_64 (64bit)

vsftpd: version 3.0.2

FileZilla_win64_3.14.1.0.1454131478

安裝VSFTPD

1.首先确認系統内無VSFTPD。

rpm -qa|grep vsftpd

若有的話會顯示vsftpd-x.x.x.-x.xxx.x86_64

若沒有的話會空傳回

2.安裝VSFTPD

yum -y install vsftpd

3.設定開機啟動

chkconfig vsftpd on

配置VSFTPD

1.打開vsftpd配置檔案/etc/vsftpd/vsftpd.conf

cd /etc/vsftpd

vi vsftpd.conf

.

anonymous_enable=NO //設定不允許匿名通路

local_enable=YES //設定本地使用者可以通路。注:如使用虛拟宿主使用者,在該項目設定為NO的情況下所有虛拟使用者将無法通路

chroot_list_enable=YES //使使用者不能離開主目錄

chroot_list_file=/etc/vsftpd/chroot_list ascii_upload_enable=YES

ascii_download_enable=YES //設定支援ASCII模式的上傳和下載下傳功能

pam_service_name=vsftpd //PAM認證檔案名。PAM将根據/etc/pam.d/vsftpd進行認證

//已下三個請在配置檔案中手動添加

guest_enable=YES //設定啟用虛拟使用者功能

guest_username=ftp //指定虛拟使用者的宿主使用者,CentOS中已經有内置的ftp使用者了

user_config_dir=/etc/vsftpd/vuser_conf //設定虛拟使用者個人vsftp的CentOS

FTP服務檔案存放路徑。存放虛拟使用者個性的CentOS FTP服務檔案(配置檔案名=虛拟使用者名

2.建立使用者密碼檔案/etc/vsftpd/vuser_passwd.txt ,注意奇行是使用者名,偶行是密碼

vi vuser_passwd.txt

admin

passwd

3.生成虛拟使用者認證的db檔案

db_load -T -t hash -f /etc/vsftpd/vuser_passwd.txt

/etc/vsftpd/vuser_passwd.db

ls 檢視有沒有vuser.passwd.db生成

4.編輯認證檔案/etc/pam.d/vsftpd

把前面的注釋去掉,然後加上以下幾條

注:db=/etc/vsftpd/vuser_passwd 中的vuser_passwd 是你生成的虛拟使用者的db檔案

檢視系統版本号: getconf LONG_BIT

系統為32位:

auth required pam_userdb.so db=/etc/vsftpd/vuser_passwd account

required pam_userdb.so db=/etc/vsftpd/vuser_passwd

系統為64位:

auth required /lib64/security/pam_userdb.so

db=/etc/vsftpd/vuser_passwd account required

/lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd

5.建立虛拟使用者配置檔案

mkdir /etc/vsftpd/vuser_conf/

vi /etc/vsftpd/vuser_conf/admin

//檔案名等于vuser_passwd.txt裡面的賬戶名,否則下面設定無效

6.設定使用者配置檔案内容

local_root=/storage/ftp //虛拟使用者根目錄,根據實際情況修改 該目錄必須要有讀寫權限

write_enable=YES //可寫

anon_umask=022 //掩碼

anon_world_readable_only=NO

anon_upload_enable=YES

anon_mkdir_write_enable=YES

anon_other_write_enable=YES

7.設定檔案夾權限

chmod -R 777 /storage

8.設定Selinux

setsebool -P ftp_home_dir=1 //設定ftp可以使用home目錄

setsebool -P allow_ftpd_full_access=1 //設定ftp使用者可以有所有權限

9.啟動vsftpd服務

service vsftpd start

使用FileZilla連接配接

使用快速連接配接功能。填入主機号,剛剛設定好的賬戶密碼admin/passwd

繼續閱讀