centos6.5 安裝FTP

一.檢查是否安裝:

rpm -qa | grep vsftpd

2、若是未安裝,則yum安裝

yum install vsftpd

3、設置vsftpd開機啓動

chkconfig --level 35 vsftpd on

systemctl enable vsftpd.service

4、配置文件的修改,位置 /etc/vsftpd/vsftpd.conf

anonymous_enable=NO  # 是否開啓匿名登陸linux

local_enable=YES   # 是否容許本地用戶登陸bash

write_enable=YES  # 是否容許上傳服務器

local_umask=022   # 默認的umask碼app

diremssage_enable=YES  # 是否顯示目錄說明文件tcp

xferlog_enable=YES  # 是否記錄ftp傳輸過程spa

connect_from_prot_20=YES # 是否肯定端口傳輸來自20rest

xferlog_ftd_format=YES   # 是否使用標準的ftp xferlog模式code

chroot_list_enable=YES  # 是否將系統用戶限制在本身的home目錄下orm

chroot_list_file=/etc/vsftpd/chroot_list  # 列表不受限制的用戶rem

listen=YES   # 是否開啓監聽

pam_service_name=vsftpd # 服務名稱

userlist_enable=YES

tcp_wrappers=YES

5、建立ftp用戶,設置屬性

useradd -d /home/www/test -g ftp -s /sbin/nologin test  
# 指定用戶 test 屬於組 ftp,只能訪問的目錄是/home/www/test,不能登錄系統
passwd test  # 設置該用戶的密碼

新建文件/etc/vsftpd/chroot_list,在chroot_list里加入ftp帳戶名test

同目錄下的文件user_list也在文本底部添加ftp帳戶名test

6、啓動開啓FTP
chkconfig vsftpd on

查看ftp狀態: sestatus -b | grep ftp

# 啓動ftp服務
service vsftpd start
# 查看ftp服務狀態
service vsftpd status 
# 重啓ftp服務
service vsftpd restart
# 關閉ftp服務
service vsftpd stop

設置權限

usermod -s /sbin/nologin test //限定用戶test不能telnet,只能ftp,不容許用於用戶登陸
usermod -s /sbin/bash test //用戶test恢復正常
usermod -d /test2 test //更改用戶test的主目錄爲/test2

passwd test   //爲test用戶設置密碼

限制用戶只能訪問/home/test,不能訪問其餘路徑
修改/etc/vsftpd/vsftpd.conf以下:

chroot_local_user=YES   //是否限制本地用戶限制訪問自身目錄之外的文件
chroot_list_enable=YES //chroot_list文件是否啓用,指定的是用戶列表功能是否有效
# (default follows)
chroot_list_file=/etc/vsftpd/vsftpd.chroot_list

編輯 vsftpd.chroot_list文件,將受限制的用戶添加進去,每一個用戶名一行
改完配置文件,不要忘記重啓vsFTPd服務器
[root@linuxsir001 root]# /etc/init.d/vsftpd restart

若是用戶不能上傳文件,記得
chmod -R 777 /file
相關文章
相關標籤/搜索