日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

centos7.5 搭建上FTP服务

發布時間:2023/10/11 综合教程 88 老码农
生活随笔 收集整理的這篇文章主要介紹了 centos7.5 搭建上FTP服务 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.安裝FTP

# 查看ftp 是否安裝
rpm -qa | grep vftpd # 安裝vsftp
yum install -y vsftpd # 設置ftp 開機啟動
systemctl enable vsftpd # 啟動|停止|重啟 ftp
systemctl [start|stop|restart] vsftpd # 查看狀態
systemctl status vsftpd

2.配置FTP

# 編輯ftp配置文件
vim /etc/vsftpd/vsftpd.conf
# 顯示行號
:set number
# 禁止匿名登錄
anonymous_enables=NO # 是否以ASCII方式傳輸數據。默認情況下,服務器會忽略ASCII方式的請求。
# 啟用此選項將允許服務器以ASCII方式傳輸數據
# 不過,這樣可能會導致由"SIZE /big/file"方式引起的DoS攻擊
ascii_upload_enable=YES
ascii_download_enable=YES # 將用戶限制在主目錄
chroot_local_user=YES #添加下列內容到vsftpd.conf末尾
use_localtime=YES
listen_port=21
idle_session_timeout=300
guest_enable=YES
guest_username=ftp
user_config_dir=/etc/vsftpd/vconf
data_connection_timeout=1
virtual_use_local_privs=YES
pasv_min_port=40000
pasv_max_port=40010
accept_timeout=5
connect_timeout=1
allow_writeable_chroot=YES

3.建立用戶文件

#創建編輯用戶文件
vim /etc/vsftpd/virtusers
#第一行為用戶名,第二行為密碼。不能使用root作為用戶名 user

4.生成用戶數據文件

db_load -T -t hash -f /etc/vsftpd/virtusers /etc/vsftpd/virtusers.db
#設定PAM驗證文件,并指定對虛擬用戶數據庫文件進行讀取
chmod 600 /etc/vsftpd/virtusers.db

5.修改 /etc/pam.d/vsftpd 文件

# 修改前先備份 

cp /etc/pam.d/vsftpd /etc/pam.d/vsftpd.bak

vi /etc/pam.d/vsftpd
#先將配置文件中原有的 auth 及 account 的所有配置行均注釋掉
auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/virtusers
account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/virtusers # 如果系統為32位,上面改為lib

6.生成主目錄,修改權限

mkdir -r /home/vsftpd/
chmod -R 777 /home/vsftpd

7.建立虛擬用戶個人配置文件

cd /etc/vsftpd/vconf

#這里建立虛擬用戶user配置文件
touch user #編輯user用戶配置文件,內容如下,其他用戶類似
vi user local_root=/home/vsftpd/user/
write_enable=YES
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
#建立user用戶根目錄
mkdir -p /home/vsftpd/user/

 8.關閉防火墻和selinux

#臨時關閉防火墻
systemctl stop firewalld #禁止防火墻開機啟動
systemctl disable firewalld #關閉selinux
setenforce #修改/etc/selinux/config (SELINUX=disabled)
vi /etc/selinux/config

重啟vsftp服務,如果無法正常讀寫文件,檢查目錄權限。

總結

以上是生活随笔為你收集整理的centos7.5 搭建上FTP服务的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。