- 安裝VSFTP
?
# 使用yum安裝 yum?-y install?ftp?vsftpd # 或者使用rpm安裝以下兩個包 ftp-0.17-66.el7.x86_64 vsftpd-3.0.2-9.el7.x86_64 # 另外需要安裝db包,用來加密虛擬用戶的賬戶信息 # 這個包在centos7中默認已經安裝了 #?rpm?-qf /usr/bin/db_load libdb-utils-5.3.21-17.el7_0.1.x86_64
?
- 配置
#?mkdir -p /ftp/open // 做幾個測試文件 #?echo?opentest?>?/ftp/open/open.txt #?echo?filetest?>?/tmp/filetest1.txt#?touch?/ftp/open/anontest.txt//查看配置文件所在路徑 #?rpm?-qc?vsftpd /etc/logrotate.d/vsftpd /etc/pam.d/vsftpd /etc/vsftpd/ftpusers /etc/vsftpd/user_list /etc/vsftpd/vsftpd.conf#?cd?/etc/vsftpd/ //備份原有配置文件 #?cp?vsftpd.conf?vsftpd.conf.origin//創建密碼明文文件 #?vi /etc/vsftpd/vftpuser.txt test P@ssw0rd//根據明文創建密碼DB文件 #?db_load?-T?-t?hash?-f?/etc/vsftpd/vftpuser.txt?\ /etc/vsftpd/vftpuser.db//查看密碼數據文件 #?file /etc/vsftpd/vftpuser.db /etc/vsftpd/vftpuser.db:?Berkeley?DB?(Hash,?version9,?native?byte-order)//創建vftpd的guest賬戶 #?useradd?-d /ftp/private?-s?/sbin/nologin?vftpuser#?vi /etc/pam.d/vsftpd // 將auth及account的所有配置行行均注釋掉,添加如下內容: auth?required?pam_userdb.so?db=/etc/vsftpd/vftpuser account?required?pam_userdb.so db=/etc/vsftpd/vftpuser //打開配置文件 #?vi /etc/vsftpd/vsftpd.conf //在最后添加 anon_root=/ftp/open virtual_use_local_privs=YES guest_enable=YES guest_username=vftpuser chroot_local_user=YES allow_writeable_chroot=YES
- 設置自啟動
?
#?systemctl enable vsftpd ln?-s'/usr/lib/systemd/system/vsftpd.service''/etc/systemd/system/multi-user.target.wants/vsftpd.service'
?
- 注意事項
- 需將端口添加到防火墻例外
- 關閉SELinux
//查看SELinux狀態: 1、/usr/sbin/sestatus -v ? ? ?##如果SELinux status參數為enabled即為開啟狀態 SELinux status: ? ? ? ? ? ? ? ? enabled 2、getenforce ? ? ? ? ? ? ? ? ##也可以用這個命令檢查 關閉SELinux: 1、臨時關閉(不用重啟機器): setenforce 0 ? ? ? ? ? ? ? ? ?##設置SELinux 成為permissive模式##setenforce 1 設置SELinux 成為enforcing模式 2、修改配置文件需要重啟機器: 修改/etc/selinux/config 文件 將SELINUX=enforcing改為SELINUX=disabled 重啟機器即可
centos7下怎樣架構ftp,?