您现在的位置是:群英 > 服务器 > 系统运维
linux下vsftpd有没有安装怎样检测,方法是什么
Admin发表于 2022-08-24 17:56:331245 次浏览
这篇文章分享给大家的内容是关于linux下vsftpd有没有安装怎样检测,方法是什么,本文介绍得很详细,内容很有参考价值,希望可以帮到有需要的小伙伴,接下来就让小编带领大家一起了解看看吧。


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

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

检测是否安装了vsftpd

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

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

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

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

如果没有安装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下vsftpd有没有安装怎样检测,方法是什么”已经有了进一步的了解,更多相关的问题,欢迎关注群英网络或到群英官网咨询客服。

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。

标签: vsftpd安装
相关信息推荐
2023-06-06 08:50:06 
摘要:SSH如何通过公钥连接云服务器
2023-09-23 11:52:22 
摘要:centos搭建git服务器,并同步线上项目
2023-07-07 11:50:30 
摘要:CentOS7安装和配置FTP
群英网络助力开启安全的云计算之旅
立即注册,领取新人大礼包
  • 联系我们
  • 24小时售后:4006784567
  • 24小时TEL :0668-2555666
  • 售前咨询TEL:400-678-4567

  • 官方微信

    官方微信
Copyright  ©  QY  Network  Company  Ltd. All  Rights  Reserved. 2003-2019  群英网络  版权所有   茂名市群英网络有限公司
增值电信经营许可证 : B1.B2-20140078   粤ICP备09006778号
免费拨打  400-678-4567
免费拨打  400-678-4567 免费拨打 400-678-4567 或 0668-2555555
微信公众号
返回顶部
返回顶部 返回顶部