1.针对本地用户模式的权限参数以及作用如下

[root@localhost ~]# vim /etc/vsftpd/vsftpd.conf
1 anonymous_enable=NO
2 local_enable=YES
3 write_enable=YES
4 local_umask=022

5 dirmessage_enable=YES
6 xferlog_enable=YES
7 connect_from_port_20=YES
8 xferlog_std_format=YES
9 listen=NO
10 listen_ipv6=YES
11 pam_service_name=vsftpd
12 userlist_enable=YES
13 tcp_wrappers=YES  
[root@localhost ~]# systemctl restart vsftpd
[root@localhost ~]# 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 2020-09-03 11:05:40 CST; 1s ago
Process: 75088 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
Main PID: 75089 (vsftpd)
CGroup: /system.slice/vsftpd.service
└─75089 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf Sep 03 11:05:40 localhost.localdomain systemd[1]: Starting Vsftpd ftp daemon...
Sep 03 11:05:40 localhost.localdomain systemd[1]: Started Vsftpd ftp daemon.

在 vsftpd 服务程序的主配置文件中正确填写参数,然后保存并退出。还需要重启vsftpd服务程序,让新的配置参数生效。最后将配置好的服务添加到开机启动项中,以便在系统重启自后依然可以正常使用vsftpd 服务。

[root@localhost ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.

2.在使用root 管理员登录后,系统提示如下的错误信息:

[root@localhost ~]# ftp 10.10.64.109
Connected to 10.10.64.109 (10.10.64.109).
220 (vsFTPd 3.0.2)
Name (10.10.64.109:root): root
530 Permission denied.
Login failed.
ftp>

在输入root 管理员的密码之前,就已经被系统拒绝访问了。这是因为vsftpd 服务程序所在的目录中默认存放着两个名为“用户名单”的文件(ftpusers 和user_list)。

vsftpd 服务程序为了保证服务器的安全性而默认禁止了root 管理员和大多数系统用户的登录行为,这样可以有效地避免黑客通过FTP 服务对root 管理员密码进行暴力破解。如果确认在生产环境中使用root 管理员不会对系统安全产生影响,  只需删除掉root 用户名即可。

[root@localhost ~]# cat /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  
[root@localhost ~]# cat /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账号和密码即可登录

[root@localhost ~]# ftp 10.10.64.109
Connected to 10.10.64.109 (10.10.64.109).
220 (vsFTPd 3.0.2)
Name (10.10.64.109:root): root
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

3.选择ftpusers 和user_list 文件中没有的一个普通用户尝试登录FTP 服务器:

[root@localhost ~]# ftp 10.10.64.109
Connected to 10.10.64.109 (10.10.64.109).
220 (vsFTPd 3.0.2)
Name (10.10.64.109:root): centos
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> mkdir files
550 Create directory operation failed.
ftp>   

在采用本地用户模式登录FTP 服务器后,默认访问的是该用户的家目录,也就是说,访问的是/home/centos 目录。而且该目录的默认所有者、所属组都是该用户自己,因此不存在写入权限不足的情况。

但是当前的操作仍然被拒绝,是因为需要开启SELinux 域中对FTP 服务的允许策略:

[root@localhost ~]# getsebool -a | grep ftp
ftpd_anon_write --> off
ftpd_connect_all_unreserved --> off
ftpd_connect_db --> off
ftpd_full_access --> off
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
tftp_anon_write --> off
tftp_home_dir --> off
[root@localhost ~]# setsebool -P ftpd_full_access=on

在设置SELinux域策略时,一定记得添加-P参数,否则服务器在重启后就会按照原有的策略进行控制,从而导致配置过的服务无法使用。在配置妥当后再使用本地用户尝试登录下FTP 服务器,分别执行文件的创建、重命名及删除等命令。操作均成功!

[root@localhost ~]# ftp 10.10.64.109
Connected to 10.10.64.109 (10.10.64.109).
220 (vsFTPd 3.0.2)
Name (10.10.64.109:root): centos
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> mkdir files
257 "/home/centos/files" created
ftp> rename files database
350 Ready for RNTO.
250 Rename successful.
ftp> rmdir database
250 Remove directory operation successful.
ftp> exit
221 Goodbye.

33.vsftpd服务程序--本地用户模式的更多相关文章

  1. 34.vsftpd服务程序--虚拟用户模式

    1.创建用于进行FTP 认证的用户数据库文件,其中奇数行为账户名,偶数行为密码. [root@localhost ~]# cd /etc/vsftpd/ [root@localhost vsftpd] ...

  2. 演示vsftpd服务匿名访问模式、本地用户模式的配置

    文件传输协议(FTP,File Transfer Protocol) 即能够让用户在互联网中上传.下载文件的文件协议,而FTP服务器就是支持FTP传输协议的主机,要想完成文件传输则需要FTP服务端和F ...

  3. 使用Vsftpd服务(匿名访问模式、本地用户模式)

    FTP协议占用两个端口号: 21端口:命令控制,用于接收客户端执行的FTP命令. 20端口:数据传输,用于上传.下载文件数据.. FTP数据传输的类型: 主动模式:FTP服务端主动向FTP客户端发起连 ...

  4. 在虚拟机上的关于FTP FTP访问模式(本地用户模式)

    首先你要有vsftpd服务 可以先去yum中下载(当然你要有本地yum仓库) 输入命令: yum  install  vsftpd 下载完成之后打开vsftpd服务 输入命令:systemctl   ...

  5. linux虚拟机中FTP本地用户模式配置流程

    1.首先在自己虚拟机中安装vsftpd服务,可以先去yum中下载(当然你要有本地yum仓库) 输入命令: yum  install  vsftpd 下载完成之后打开vsftpd服务 输入命令:syst ...

  6. 32.vsftpd服务程序--匿名开放模式

    1.vsftpd服务程序 vsftpd 作为更加安全的文件传输的服务程序,允许用户以三种认证模式登录到FTP 服务器上. 匿名开放模式:是一种最不安全的认证模式,任何人都可以无需密码验证而直接登录到F ...

  7. 不关闭seLinux解决vsftpd服务本地用户不能登录问题(500 OOPS: cannot change directory:/home/***

    这里不讲vsftpd的基本配置,网上教程已经太多了.这里只说seLinux的问题. 日前在CentOS6.5中安装了vsftpd,按照网上搜索的教程,配置好/etc/vsftpd/vsftpd.con ...

  8. CentOS6.5下搭建ftp服务器(三种认证模式:匿名用户、本地用户、虚拟用户)

    CentOS 6.5下搭建ftp服务器 vsftpd(very secure ftp daemon,非常安全的FTP守护进程)是一款运行在Linux操作系统上的FTP服务程序,不仅完全开源而且免费,此 ...

  9. vsftpd服务程序的三种认证模式

    vsftpd服务程序的三种认证模式的配置方法——匿名开放模式.本地用户模式以及虚拟用户模式.了解PAM可插拔认证模块的原理.作用以及实战配置方法,通过实战课程进一步继续学习SELinux服务的配置方法 ...

随机推荐

  1. docker获取Let's Encrypt永久免费SSL证书

    一 起因 官方的cerbot太烦了,不建议使用 还不如野蛮生长的acme.sh,而这里介绍docker运行cerbot获取Let's Encrypt永久免费SSL证书 二 选型 cerbot的证书不会 ...

  2. 安装Apache2.4 操作系统:Centos7.4

    正式安装Apache2.4 操作系统:Centos7.4,(需要关闭Selinux)1.在每安装一个服务都要养成查看是否安装,如果安装则需要卸载: #[root@yankerp ~]# rpm -qa ...

  3. 微信小程序 更新版本操作

    1.小程序的启动方式: 冷启动----小程序首次打开或销毁后再次被打开 热启动----小程序打开后,在一段时间内(目前:5分钟)再次被打开,此时会将后台的小程序切换到前台. 2.根据以上两种启动方式, ...

  4. Apache的Mod_rewrite学习(RewriteRule重写规则的语法) 转

    RewriteRuleSyntax: RewriteRule Pattern Substitution [flags] 一条RewriteRule指令,定义一条重写规则,规则间的顺序非常重要.对Apa ...

  5. 织梦dedecms自增变量autoindex标签的使用(转)

    织梦dedecms自增变量autoindex标签的使用 例1: {dede:arclist titlelen='120' row='8' typeid='2'}         <li clas ...

  6. Lagom 官方文档之随手记

    引言 Lagom是出品Akka的Lightbend公司推出的一个微服务框架,目前最新版本为1.6.2.Lagom一词出自瑞典语,意为"适量". https://www.lagomf ...

  7. iostat的输出

    第一行显示的时子系统启动以来的平均值,接下来的报告显示了增量的平均值,每个设备一行 Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   ...

  8. Linux—curl命令讲解

    命令:curl 在Linux中curl是一个利用URL规则在命令行下工作的文件传输工具,可以说是一款很强大的http命令行工具.它支持文件的上传和下载,是综合传输工具,但按传统,习惯称url为下载工具 ...

  9. 一. SpringCloud简介与微服务架构

    1. 微服务架构 1.1 微服务架构理解 微服务架构(Microservice Architecture)是一种架构概念,旨在通过将功能分解到各个离散的服务中以实现对解决方案的解耦.你可以将其看作是在 ...

  10. 视图V_160M和表T_160M的维护

    今天发现一个视图,通过SM30居然无法维护,这个视图就是V_160M,表为T_160M,是采购相关的系统消息, 不过别着急,有办法维护的,呵呵,看下面: 试一试OMCQ这个事物代码吧! 分享出来,给需 ...