CentOS 搭建ftp服务器

   Linux  CentOS    FTP

安装vsftpd

1
yum install vsftpd

配置vsftpd.conf

1
2
3
4
5
6
7
8
9
10
11
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO

# When SELinux is enforcing check for SE bool ftp_home_dir
local_enable=YES


write_enable=YES

# 本地的ftp目录地址
local_root=/var/ftp

添加ftp用户

1
2
3
4
5
#创建用户
adduser -d /var/ftp -g ftp -s /sbin/nologin *_ftp

#修改密码
passwd *_ftp

上传权限

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 修改上传路径权限  777   更具个人喜好设置权限
sudo chmod -R 777 /var/ftp

# 查看 ftp 设置
getsebool -a|grep ftp

ftp_home_dir --> on
ftpd_anon_write --> off
ftpd_connect_all_unreserved --> off
ftpd_connect_db --> off
ftpd_full_access --> on
ftpd_use_cifs --> off
ftpd_use_fusefs --> off
ftpd_use_nfs --> off
ftpd_use_passive_mode --> off
httpd_can_connect_ftp --> off
httpd_enable_ftp_server --> off
sftpd_anon_write --> off
sftpd_enable_homedirs --> off
sftpd_full_access --> off
sftpd_write_ssh_home --> off
tftp_anon_write --> off
tftp_home_dir --> off

# 修改ftp_home_dir、ftpd_full_access 为 on
setsebool -P ftp_home_dir=on ftpd_full_access=on

设置vsftp 开机启动

1
chkconfig vsftpd on

添加防火墙

1
2
firewall-cmd --permanent --add-service=ftp
firewall-cmd --reload
  1. 安装vsftpd
  2. 配置vsftpd.conf
  3. 添加ftp用户
  4. 上传权限
  5. 设置vsftp 开机启动
  6. 添加防火墙
CentOS Git 服务器搭建
kernel 内核安装