CentOS7服务器环境下vsftpd安装及配置方法

2019-10-10 12:26:54于海丽

本文实例讲述了CentOS7服务器环境下vsftpd安装及配置方法。,具体如下:

0x:卸载vsftpd

[root@localhost ~]# yum remove vsftpd
[root@localhost ~]# find / -name "vsftpd*"
/etc/vsftpd
/etc/vsftpd/vsftpd.conf.bak
[root@localhost ~]# rm -fr /etc/vsftpd/

1x:重新安装

[root@localhost home]#yum -y install vsftpd
[root@localhost home]# systemctl start vsftpd.service
[root@localhost home]# systemctl status vsftpd.service

● vsftpd.service - Vsftpd ftp daemon
 Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
 Active: active (running) since Thu 2017-11-09 21:15:18 EST; 8s ago
 Process: 5716 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 5717 (vsftpd)
 CGroup: /system.slice/vsftpd.service
   └─5717 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
Nov 09 21:15:18 localhost.localdomain systemd[1]: Starting Vsftpd ftp daemon...
Nov 09 21:15:18 localhost.localdomain systemd[1]: Started Vsftpd ftp daemon.
Hint: Some lines were ellipsized, use -l to show in full.

Active: active (running) 说明安装已完成

2x:本地用户配置

[root@localhost vsftpd]# useradd test1
[root@localhost vsftpd]# passwd test1
Changing password for user test1.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.

添加test1本地帐户,下面是用业查询本地帐号,及黑名单

[root@localhost vsftpd]# cat /etc/passwd
[root@localhost vsftpd]# vi /etc/vsftpd/ftpusers
[root@localhost vsftpd]# vi /etc/vsftpd/user_list
[root@localhost vsftpd]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
polkitd:x:999:997:User for polkitd:/:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
chrony:x:998:996::/var/lib/chrony:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash
www:x:1000:1000::/home/www:/bin/bash
nginx:x:997:995:nginx user:/var/cache/nginx:/sbin/nologin
virtual:x:1001:1001::/home/ftpsite:/bin/bash
virtual1:x:1002:1002::/home/ftpsite:/bin/bash
vsftpd:x:1003:1003::/home/vsftpd:/sbin/nologin
overlord:x:1004:1004::/home/overlord:/sbin/nologin
test1:x:1005:1005::/home/test1:/bin/bash
[root@localhost vsftpd]# vi /etc/vsftpd/ftpusers
# Users that are not allowed to login via ftp
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
[root@localhost vsftpd]# vi /etc/vsftpd/user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody