ftp服务器修改模式,ftp服务器三种模式

一、匿名开放模式(最不安全)

1、[[email protected] ~]# vim  /etc/vsftpd/vsftpd.conf  (主配置)

anonymous_enable=YES    //允许匿名访问模式

anon_umask=022               //匿名用户上传文件的的umask值

anon_upload_enable=YES    //允许匿名用户上传文件

anon_mkdir_write_enable=YES  //允许匿名用户创建目录

anon_other_write_enable=YES    //允许匿名用户修改目录名称或删除目录

local_enable=YES

write_enable=YES

local_umask=022

dirmessage_enable=YES

xferlog_enable=YES

connect_from_port_20=YES

xferlog_std_format=YES

listen=NO

listen_ipv6=YES

pam_service_name=vsftpd

userlist_enable=YES

tcp_wrappers=YES

2、[[email protected] ~]# systemctl restart vsftpd

3、[[email protected] ~]# systemctl enable vsftpd

4、[[email protected] ~]# yum install -y ftp  (命令行管理工具)

注:该模式默认用户为anonymous,密码为空,默认访问目录/var/ftp

5、[[email protected] ~]# ftp 192.168.40.132

Connected to 192.168.40.132 (192.168.40.132).

220 (vsFTPd 3.0.2)

Name (192.168.40.132:root):anonymous

331 Please specify the password.

Password:

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files.

ftp> cd pub

250 Directory successfully changed.

ftp> mkdir zjz1  (创建新文件夹)

257 "/pub/zjz1" created

ftp> rename zjz1  zjz2  (改名)

350 Ready for RNTO.

250 Rename successful.

ftp> rmdir zjz2  (删除)

250 Remove directory operation successful.

ftp> exit  (退出)

221 Goodbye.

注:第一次做时权限不够。解决:1、[[email protected] ~]# chown -Rf ftp /var/ftp/pub

2、[[email protected] ~]# getsebool -a | grep ftp ;[[email protected] ~]# setsebool -p  ftpd_full_access=on (或直接关闭selinux)

3、关闭防火墙

二、本地用户模式

1、[[email protected] ~]# vim /etc/vsftpd/vsftpd.conf

anonymous_enable=NO  //禁止匿名访问

local_enable=YES   //允许本地用户模式

write_enable=YES   //设置可写权限

local_umask=022   本地用户创建文件的的umask值

userlist_enable=YES   //启用“禁止用户名单”,名单文件为ftpusers 和 user_list

userlist_deny=YES  //开启用户作用名单文件功能

dirmessage_enable=YES

xferlog_enable=YES

connect_from_port_20=YES

xferlog_std_format=YES

listen=NO

listen_ipv6=YES

pam_service_name=vsftpd

userlist_enable=YES

tcp_wrappers=YES

2、[[email protected] ~]# systemctl restart vsftpd

3、[[email protected] ~]# systemctl enable vsftpd

4、[[email protected] ~]# ftp 192.168.40.132

Connected to 192.168.40.132 (192.168.40.132).

220 (vsFTPd 3.0.2)

Name (192.168.40.132:root): root  (被拒绝)

530 Permission denied.

Login failed.

ftp>

5、[[email protected] ~]# cd /etc/vsftpd/[[email protected] vsftpd]# ls

ftpusers  user_list vsftpd.conf  vsftpd_conf_migrate.sh  注:上面两个文件夹就是禁止名单,root被禁止对系统更安全

6、[[email protected] ~]# ftp 192.168.40.132

Connected to 192.168.40.132 (192.168.40.132).

220 (vsFTPd 3.0.2)

Name (192.168.40.132:root): cui  (本地用户)

331 Please specify the password.

Password:  (要密码)

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files.

ftp>

其余同匿名模式

三、虚拟用户模式(最安全)

1、[[email protected] ~]# cd /etc/vsftpd/

[[email protected] vsftpd]# ls

ftpusers  user_list  vsftpd.conf  vsftpd_conf_migrate.sh

[[email protected] vsftpd]# vim vuser_list  (创建用户数据库文件)

zhagnsan

123456 (密码)

lisi

123##(密码)2、[[email protected] vsftpd]# db_load -T -t hash -f vuser.list vuser.db  (哈希加密)

3、[[email protected] vsftpd]# file vuser.db

vuser.db: Berkeley DB (Hash, version 9, native byte-order)4、[[email protected] vsftpd]# chmod 600 vuser.db

5、[[email protected] vsftpd]# rm   -rf   user_list

6、[[email protected] ~]# useradd -d /var/ftproot -s /sbin/nologin  virtual  (创建本地用户,指定家目录,禁止本地用户登录,)

原文:https://www.cnblogs.com/zjz20/p/11523941.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值