33.vsftpd服务程序--本地用户模式
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
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
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服务程序--本地用户模式的更多相关文章
- 34.vsftpd服务程序--虚拟用户模式
1.创建用于进行FTP 认证的用户数据库文件,其中奇数行为账户名,偶数行为密码. [root@localhost ~]# cd /etc/vsftpd/ [root@localhost vsftpd] ...
- 演示vsftpd服务匿名访问模式、本地用户模式的配置
文件传输协议(FTP,File Transfer Protocol) 即能够让用户在互联网中上传.下载文件的文件协议,而FTP服务器就是支持FTP传输协议的主机,要想完成文件传输则需要FTP服务端和F ...
- 使用Vsftpd服务(匿名访问模式、本地用户模式)
FTP协议占用两个端口号: 21端口:命令控制,用于接收客户端执行的FTP命令. 20端口:数据传输,用于上传.下载文件数据.. FTP数据传输的类型: 主动模式:FTP服务端主动向FTP客户端发起连 ...
- 在虚拟机上的关于FTP FTP访问模式(本地用户模式)
首先你要有vsftpd服务 可以先去yum中下载(当然你要有本地yum仓库) 输入命令: yum install vsftpd 下载完成之后打开vsftpd服务 输入命令:systemctl ...
- linux虚拟机中FTP本地用户模式配置流程
1.首先在自己虚拟机中安装vsftpd服务,可以先去yum中下载(当然你要有本地yum仓库) 输入命令: yum install vsftpd 下载完成之后打开vsftpd服务 输入命令:syst ...
- 32.vsftpd服务程序--匿名开放模式
1.vsftpd服务程序 vsftpd 作为更加安全的文件传输的服务程序,允许用户以三种认证模式登录到FTP 服务器上. 匿名开放模式:是一种最不安全的认证模式,任何人都可以无需密码验证而直接登录到F ...
- 不关闭seLinux解决vsftpd服务本地用户不能登录问题(500 OOPS: cannot change directory:/home/***
这里不讲vsftpd的基本配置,网上教程已经太多了.这里只说seLinux的问题. 日前在CentOS6.5中安装了vsftpd,按照网上搜索的教程,配置好/etc/vsftpd/vsftpd.con ...
- CentOS6.5下搭建ftp服务器(三种认证模式:匿名用户、本地用户、虚拟用户)
CentOS 6.5下搭建ftp服务器 vsftpd(very secure ftp daemon,非常安全的FTP守护进程)是一款运行在Linux操作系统上的FTP服务程序,不仅完全开源而且免费,此 ...
- vsftpd服务程序的三种认证模式
vsftpd服务程序的三种认证模式的配置方法——匿名开放模式.本地用户模式以及虚拟用户模式.了解PAM可插拔认证模块的原理.作用以及实战配置方法,通过实战课程进一步继续学习SELinux服务的配置方法 ...
随机推荐
- 面试官:数据库自增ID用完了会怎么样?
看到这个问题,我想起当初玩魔兽世界的时候,25H难度的脑残吼的血量已经超过了21亿,所以那时候副本的BOSS都设计成了转阶段.回血的模式,因为魔兽的血量是int型,不能超过2^32大小. 估计暴雪的设 ...
- Logstash学习之路(一)Logstash的安装
一.Logstash简介 Logstash 是一个实时数据收集引擎,可收集各类型数据并对其进行分析,过滤和归纳.按照自己条件分析过滤出符合数据导入到可视化界面.它可以实现多样化的数据源数据全量或增量传 ...
- NIO基础操作
原文链接http://zhhll.icu/2020/05/18/java%E5%9F%BA%E7%A1%80/IO/NIO%E5%9F%BA%E6%9C%AC%E6%93%8D%E4%BD%9C/ N ...
- Solon rpc 之 SocketD 协议 - 消息鉴权模式
Solon rpc 之 SocketD 协议系列 Solon rpc 之 SocketD 协议 - 概述 Solon rpc 之 SocketD 协议 - 消息上报模式 Solon rpc 之 Soc ...
- laravel5.4 接入qq第三方登录
第一步:先composer安装需要用到的依赖,命令行如下 composer require socialiteproviders/qq 第二步:在config/app.php 中的 providers ...
- 实现strStr
Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle ...
- Job for docker.service failed because start of the service was attempted too often. See "systemctl status docker.service" and "journalctl -xe" for details. To force a start use "systemctl reset-failed
安装docker时,自己添加了国内的hub.docker.com镜像 [root@ce-docker ~]# systemctl restart docker 出现以下报错:Job for docke ...
- 全网最全!彻底弄透Java处理GMT/UTC日期时间
目录 前言 本文提纲 版本约定 正文 Date类型实现 时区/偏移量TimeZone 设置默认时区 让人恼火的夏令时 Date时区无关性 读取字符串为Date类型 SimpleDateFormat格式 ...
- 翻译 - ASP.NET Core 基本知识 - 通用主机 (Generic Host)
翻译自 https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/generic-host?view=aspnetcore-5.0 ...
- 扩展:Flash消息
扩展:Flash消息 flash存值之后只能取一次 from flask import Flask,render_template,flash,get_flashed_messages,session ...