首页 运维 linux运维 linux怎么检查vsftpd是否安装

linux怎么检查vsftpd是否安装

Apr 15, 2022 pm 04:30 PM
linux vsftpd

linux检查vsftpd是否安装的方法:1、执行“rpm -qa | grep vsftpd”命令,如果输出vsftpd的相关信息则表示已经安装,否则没有安装;2、执行“vsftpd -v”命令,如果输出vsftpd的版本信息则表示安装。

linux怎么检查vsftpd是否安装

本教程操作环境:CentOS 6系统、Dell G3电脑。

检测是否安装了vsftpd

方法1:使用rpm -qa | grep vsftpd命令来检测

如果有输出vsftpd 的相关信息, 则表示已经安装了vsftpd ,否则表示未安装

1.png

方法2:使用vsftpd -v命令通过查看安装版本来检测

如果输出vsftpd的版本信息则表示安装,否则表示未安装

2.png

如果没有安装vsftpd,可利用yum来安装

由于vsftpd 软件依赖一些其他的软件和软件库, 所以采用yum 方式安装比较容易

1、配置yum 源

联网: 联网情况下,不需要其它配置

不能联网: 可以配置本地yum源,可将Centos 系统盘,配置为u pan yum

2、安装vsftpd

对于使用yum 方式安装软件,通常需要使用root 用户才能安装,安装命令: yum -y install vsftpd

[root@localhost ~]# yum -y install vsftpd
Loaded plugins: fastestmirror, security
Setting up Install Process
Determining fastest mirrors
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: mirror.bit.edu.cn
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:01
extras | 3.4 kB 00:00
extras/primary_db | 29 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 1.4 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-24.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================
Installing:
vsftpd x86_64 2.2.2-24.el6 base 156 k

Transaction Summary
=============================================================================================================================
Install 1 Package(s)

Total download size: 156 k
Installed size: 340 k
Downloading Packages:
vsftpd-2.2.2-24.el6.x86_64.rpm | 156 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : vsftpd-2.2.2-24.el6.x86_64 1/1
Verifying : vsftpd-2.2.2-24.el6.x86_64 1/1

Installed:
vsftpd.x86_64 0:2.2.2-24.el6

Complete!
登录后复制

安装成功,可以使用sftpd -v命令查看一下版本

3、默认配置

3.1 配置文件位置

vsftpd 服务配置文件默认在/etc/vsftp 目录下, 核心配置文件为vsftpd.conf.

[root@localhost ~]# ll /etc/vsftpd/
total 28
-rw-------. 1 root root 125 May 11 2016 ftpusers
-rw-------. 1 root root 361 May 11 2016 user_list
-rw-------. 1 root root 4599 May 11 2016 vsftpd.conf
-rwxr--r--. 1 root root 338 May 11 2016 vsftpd_conf_migrate.sh
-rw-------. 1 root root 4647 Jun 20 20:07 vsftpd.conf.rpmsave
[root@localhost ~]#
登录后复制

3.2 默认根目录

vsftp 服务默认根目录为/var/ftp, 此目录所属者和所属组都是root.

[root@localhost ~]# ll -d /var/ftp/
drwxr-xr-x. 3 root root 4096 Jul 1 16:58 /var/ftp/
[root@localhost ~]# ll /var/ftp/
total 4
drwxr-xr-x. 2 root root 4096 May 11 2016 pub
[root@localhost ~]#
登录后复制

3.3 默认匿名用户

vsftpd 安装过程中会创建ftp 用户作为匿名用户的代理用户,ftp 用户不能登录系统.

[root@localhost ~]# id ftp
uid=14(ftp) gid=50(ftp) groups=50(ftp)
[root@localhost ~]# cat /etc/passwd | grep ftp
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
[root@localhost ~]#
登录后复制

3.4 默认权限

默认配置下, vsftpd 服务允许匿名用户访问, 使用Linux 系统用户作为用户源, 允许系统用户登录.

  • 匿名用户权限: 根目录/var/ftp, 可读, 可下载, 不可上传文件, 不可新建文件夹, 不可删除/更名文件

  • 系统用户权限: 根目录为用户家目录,可跳出用户家目录, 对文件的权限由linux用户权限控制.

系统配置

安装vsftpd 之后, 需要对系统做一些修改配置

  • ftp_home_dir: 解决非root 用户登录报错: OOPS: child died

  • allow_ftpd_full_access: 解决不能上传文件问题

  • selinux: 解决不能登录OOPS: priv_sock_get_cmd

[root@localhost vsftpd] setsebool -P ftp_home_dir on
[root@localhost vsftpd] setsebool allow_ftpd_full_access on
[root@localhost vsftpd]# vim /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
登录后复制

服务器启动

Centos 系列可通过service 命令进行服务器的启动, 停止, 重启

1、启动服务器

[root@localhost ~]# service vsftpd start
Starting vsftpd for vsftpd: [ OK ]
[root@localhost ~]#
登录后复制

2、重启服务器

[root@localhost ~]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
[root@localhost ~]#
登录后复制

3、停止服务器

[root@localhost ~]# service vsftpd stop
Shutting down vsftpd: [ OK ]
[root@localhost ~]#
登录后复制

4、设置开机自启

可以选择将vsftpd服务设置为开机自启, 设置方式可以使用chkconfig 命令, 也可以自定义启动脚本.笔者使用chkconfig 命令. chkconfig 可以对linux 的其中运行级别分别设置开机启动.

  • 0:表示关机
  • 1:单用户模式
  • 2:无网络连接的多用户命令行模式
  • 3:有网络连接的多用户命令行模式
  • 4:不可用
  • 5:带图形界面的多用户模式
  • 6:重新启动

4.1 查看vsftpd 服务开机启动状态

[root@localhost ~]# chkconfig | grep vsftpd
vsftpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@localhost ~]#
登录后复制

4.2 修改vsftpd 开机启动

  • 我们只设置开机级别为35 的时候,自动启动vsftpd 服务即可.
[root@localhost ~]# chkconfig --level 35 vsftpd on
[root@localhost ~]# chkconfig | grep vsftpd
vsftpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
[root@localhost ~]#
登录后复制

vsftpd 防火墙设置

  • vsftpd服务默认监听20和21端口, 其它电脑要想访问,那么需要释放防火墙端口或关闭防火墙.不推荐关闭防火墙方式.
  • vsftpd 传输数据默认使用PASV安全模式,所以需要设置PASV端口上下限,并释放端口

1、设定PASV 端口上下限

编辑配置文件: /etc/vsftpd/vsftpd.conf, 文件末尾追加两行:

#设定PASV 端口下限
pasv_min_port=61000
#设定PASV 端口上限
pasv_max_port=62000
登录后复制

2、释放防火墙端口

编辑配置文件: /etc/sysconfig/iptables, 文件中添加以下配置:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 20 -j ACCEPT
-A OUTPUT -m state --state NEW -m tcp -p tcp --dport 20 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A OUTPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 61000:62000 -j ACCEPT
-A OUTPUT -m state --state NEW -m tcp -p tcp --dport 61000:62000 -j ACCEPT
登录后复制

3、重启服务

重启vsftpd服务和防火墙

[root@localhost ~]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
[root@localhost ~]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
[root@localhost ~]#
登录后复制

相关推荐:《Linux视频教程

以上是linux怎么检查vsftpd是否安装的详细内容。更多信息请关注PHP中文网其他相关文章!

本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

热门话题

Java教程
1662
14
CakePHP 教程
1418
52
Laravel 教程
1311
25
PHP教程
1261
29
C# 教程
1234
24
Linux体系结构:揭示5个基本组件 Linux体系结构:揭示5个基本组件 Apr 20, 2025 am 12:04 AM

Linux系统的五个基本组件是:1.内核,2.系统库,3.系统实用程序,4.图形用户界面,5.应用程序。内核管理硬件资源,系统库提供预编译函数,系统实用程序用于系统管理,GUI提供可视化交互,应用程序利用这些组件实现功能。

vscode终端使用教程 vscode终端使用教程 Apr 15, 2025 pm 10:09 PM

vscode 内置终端是一个开发工具,允许在编辑器内运行命令和脚本,以简化开发流程。如何使用 vscode 终端:通过快捷键 (Ctrl/Cmd ) 打开终端。输入命令或运行脚本。使用热键 (如 Ctrl L 清除终端)。更改工作目录 (如 cd 命令)。高级功能包括调试模式、代码片段自动补全和交互式命令历史。

git怎么查看仓库地址 git怎么查看仓库地址 Apr 17, 2025 pm 01:54 PM

要查看 Git 仓库地址,请执行以下步骤:1. 打开命令行并导航到仓库目录;2. 运行 "git remote -v" 命令;3. 查看输出中的仓库名称及其相应的地址。

vscode上一步下一步快捷键 vscode上一步下一步快捷键 Apr 15, 2025 pm 10:51 PM

VS Code 一步/下一步快捷键的使用方法:一步(向后):Windows/Linux:Ctrl ←;macOS:Cmd ←下一步(向前):Windows/Linux:Ctrl →;macOS:Cmd →

Linux的主要目的是什么? Linux的主要目的是什么? Apr 16, 2025 am 12:19 AM

Linux的主要用途包括:1.服务器操作系统,2.嵌入式系统,3.桌面操作系统,4.开发和测试环境。Linux在这些领域表现出色,提供了稳定性、安全性和高效的开发工具。

notepad怎么运行java代码 notepad怎么运行java代码 Apr 16, 2025 pm 07:39 PM

虽然 Notepad 无法直接运行 Java 代码,但可以通过借助其他工具实现:使用命令行编译器 (javac) 编译代码,生成字节码文件 (filename.class)。使用 Java 解释器 (java) 解释字节码,执行代码并输出结果。

sublime写好代码后如何运行 sublime写好代码后如何运行 Apr 16, 2025 am 08:51 AM

在 Sublime 中运行代码的方法有六种:通过热键、菜单、构建系统、命令行、设置默认构建系统和自定义构建命令,并可通过右键单击项目/文件运行单个文件/项目,构建系统可用性取决于 Sublime Text 的安装情况。

laravel安装代码 laravel安装代码 Apr 18, 2025 pm 12:30 PM

要安装 Laravel,需依序进行以下步骤:安装 Composer(适用于 macOS/Linux 和 Windows)安装 Laravel 安装器创建新项目启动服务访问应用程序(网址:http://127.0.0.1:8000)设置数据库连接(如果需要)

See all articles