centos7部署ftp服务器
时间: 2023-12-04 19:41:17 浏览: 134
以下是在CentOS 7上部署FTP服务器的步骤:
1.安装vsftpd软件包
```shell
yum install vsftpd -y
```
2.启动vsftpd服务并设置开机自启
```shell
systemctl start vsftpd
systemctl enable vsftpd
```
3.修改vsftpd配置文件/etc/vsftpd/vsftpd.conf
```shell
cp /etc/vsftpd/vsftpd.conf /root/vsftpd.conf.bak #备份到root家目录
vi /etc/vsftpd/vsftpd.conf #修改配置文件
```
以下是一些常用的配置项:
- anonymous_enable=YES #允许匿名用户登录
- local_enable=YES #允许本地用户登录
- write_enable=YES #允许上传文件
- chroot_local_user=YES #限制用户只能访问自己的主目录
- userlist_enable=YES #启用用户列表
- userlist_file=/etc/vsftpd/user_list #用户列表文件路径
- userlist_deny=NO #允许列表中的用户登录
4.创建FTP用户并设置密码
```shell
useradd ftpuser #创建用户
passwd ftpuser #设置密码
```
5.设置FTP用户的主目录
```shell
usermod -d /var/ftp ftpuser #将主目录设置为/var/ftp
```
6.修改FTP用户的属主为ftp
```shell
chown ftp /var/ftp/pub
```
7.重启vsftpd服务
```shell
systemctl restart vsftpd
```
阅读全文
相关推荐















