CentOS安裝vsftpd

版本:vsftpd-3.0.2-9.el7.x86_64(CentOS是64位的)。
shell

 1.安裝vsftpdvim

yum -y install vsftpd

2.配置vsftpdspa

修改配置前把原始配置文件備份一下:rest

cp /etc/vsftpd/vsftpd.conf  /etc/vsftpd/vsftpd.conf.backup

修改配置文件:code

vim /etc/vsftpd/vsftpd.conf

修改的地方blog

1)把下面的開頭的註釋去掉,限制全部的用戶均不能切換到其餘目錄it

chroot_local_user=YES

2)容許根目錄可寫class

Allow_writeable_chroot=YES

FTP的工做模式有兩種,一種是被動模式,一種是主動模式,這裏咱們使用主動模式:登錄

在文件末尾加上:ftp

port_enable=YES

若是要使用被動模式,則以下配置:

pasv_enable=Yes

pasv_min_port=40000    #pasv鏈接模式時可使用port 範圍的上界,0 表示任意

pasv_max_port=40100    #pasv鏈接模式時可使用port 範圍的下界。

3.重啓服務

systemctl restart vsftpd

設置vsftpd服務開機後自啓動:

systemctl enable vsftpd   

4.建立一個用戶

useradd -d /ftp image -s /sbin/nologin

其中,-d指定用戶登陸時的目錄,-s指定用戶登陸後所使用的shell,而後設定密碼 

passwd image 

 最後給/ftp受權:

chmod -R 755 /ftp

說明:由於以前已經關了了防火牆和SELinux,因此在這裏就不須要額外設置了。

相關文章
相關標籤/搜索