redhat网络安装系统 之二

简介: 3、 配置TFTP服务器     TFTP(Trivial File Transfer Protocol简朴文件传输协议)是TCP/IP协议族中的一个用来在客户机与服务器之间进行简单文件传输的协议,提供不复杂、开销不大的文件传输服务。

3、 配置TFTP服务器

    TFTP(Trivial File Transfer Protocol简朴文件传输协议)是TCP/IP协议族中的一个用来在客户机与服务器之间进行简单文件传输的协议,提供不复杂、开销不大的文件传输服务TFTP承载在UDP上,提供不可靠的数据流传输服务,不提供存取授权与认证机制,使用超时重传方式来保证数据的到达。与FTP相比,TFTP的大小要小的多,TFTP是用来下载远程文件的最简单网络协议,它基于UDP协议而实现。它使用的是UDP的69端口 。

配置TFTP服务器主要用途是为了能够给客户端传送bootstrap程序[pxelinux.0]这样才能够让客户端进行引导加载内核映象文件(vmlinuz)和根文件系统文件(initrd.img)以及启动内核(Kernel)

1、 TFTP的配置文件

先用rpm -qa |grep tftp 确定系统上是否装了TFTP(如果返回一个安装包的名字,说明已经安装了,参数 -a 表示已经装了的程序包)。如果没有,就去安装镜像里安装:tftp-server-0.42-3.1 程序包。如果安装了,修改/etc/xinetd.d/tftp  

TFTP的配置文件为 /etc/xinetd.d/tftp

 配置内容如下:

 #default off

#descriptionThe tftp server serves files using the trivialfiletransfer \

#protocol. The tftp protocol is often used to bootdiskless \

#workstations, download configuration files tonetwork-awareprinters, \

#and to start the installation process for someoperatingsystems.

service tftp

{

        disable= no

       socket_type            = dgram

       protocol               = udp

#      protocol               = tcp

       wait                   = yes

       user                   = root

       server                 = /usr/sbin/in.tftpd

       server_args            = -u nobody -s /tftpboot                         #指定TFTP的根目录所在位置,允许任何用户可以进行访问参数-s指定chroot,-c指定了可以创立文件

       per_source             = 11

       cps                    = 100 2

       flags                  = IPv4

}

在这里主要修改的字段是disable ,yes改为no。以打开TFTP服务


2、启动TFTP服务

 #service xinetd restart

 

附加:(以下操作与本次安装无关,仅作扩展练习)创立tftp根目录,关闭防火墙,启动tftp-server

[root@wk ~]# mkdir /tftpboot

[root@wk ~]# chmod -R 777 /tftpboot

[root@wk ~]# /etc/init.d/iptables stop

[root@wk ~]# service xinetd restart

重启xinetd服务,因为TFTP服务受控与xinetd服务,xinetd是管服务的服务,它是不开端口的。

所以要验证一下TFTP是否开启69端口起来了:

[root@wk ~]# netstat -nlp

2.udp 0 0 0.0.0.0:67 0.0.0.0:* 5172/dnsmasq

3.udp 0 0 0.0.0.0:67 0.0.0.0:* 4745/dhcpd

4.udp 0 0 0.0.0.0:69 0.0.0.0:* 6171/xinetd

5.udp 0 0 0.0.0.0:994 0.0.0.0:* 4633/rpc.rquotad

如何测试 tftp 是否成功开启?

在 tftp 目录下创建一个文件,比如 1.txt 。
在 Shell 中连接 tftp 服务:

tftp 127.0.0.1

我擦,显示:command not  found 。。。咋回事呢?原来在本机上还要装tftp客户端,就是这个包:tftp-0.42-3.1.i386.rpm也在镜像中找。。然后在运行:

tftp 127.0.01


tftp>get 1.txt

若服务成功开启,则能看到成功下载文件的提示。并在当前目录下找到1.txt文件。

ftp>help   ——查看命令。

tftp>q        ——和quit一样,标识退出,但是没有exit这个命令。


4、配置FTP服务器

    配置FTP服务器主要用途是为了能够给客户端传送Linux的配置环境与安装程序。安装是选择ftp的方式,ftp服务器是192.168.0.15

启动后利用匿名账户进行测试,如果测试成功您就可以将RHEL45张光盘中的所有安装文件全部拷贝到匿名用户的文件夹/var/ftp/目录下。注意:如果用anonymous,则ftp的路径就是“/”,如果用non-anonymous,例如用root,则ftp的路径是“/var/ftp”,需要把整个安装光盘拷贝到/var/ftp路径下。

 

1.准备工作

要运行FTP服务,先要安装FTP服务的服务器软件包.:

在RHEL4中,该软件包在 disc 1中,包名为 : vsftpd-2.0.1-5.i386.rpm

在RHEL5中镜像中的Server程序包中即可找到包[root@linux01 Server]# ls | grep vsftpd* # 查询当前路径下安装包

rpm -ivh vsftpd-2.0.1-5.i386.rpm     //安装该软件包,在var目录下生成目录ftp/pub

正确安装软件包后,就可以对FTP服务器的主配置文件进行修改了

root@linux01 Server]# rpm -qa | grep ^vsftpd  # 再次查询相关已经安装的软件包
vsftpd-2.0.5-12.el5
root@linux01 ~]# rpm -ql vsftpd | grep etc  # 查询etc中与vsftpd相关的文件
/etc/logrotate.d/vsftpd.log
/etc/pam.d/vsftpd
/etc/rc.d/init.d/vsftpd
/etc/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
/etc/vsftpd/vsftpd_conf_migrate.sh


2.修改FTP服务器的主配置文件/etc/vsftpd/vsftpd.conf

该配置文件是在安装软件包的时候自动生成的,不要我们手动建立,我们只需要对它做必要的修改就可以让FTP服务器正常运行了.修改示例如下

[root@linux01 Server]# cat /etc/vsftpd/vsftpd.conf        # 读取原文,默认配置

# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES  # 允许匿名登录
#
# Uncomment this to allow local users to log in.
local_enable=YES  # 允许本地帐户登录
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES  # 开放对本地用户的写权限
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022  # 本地用户的文件生成掩码
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES  # 显示目录下的.message
#
# Activate logging of uploads/downloads.
xferlog_enable=YES  # 启用上传和下载日志
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES  # 启用FTP数据端口
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=YES  # 使用标准的ftpd xferlog日志格式
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES  # FTP服务器处于独立启动模式(相对于受xinnetd管理的启动模式)
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd whith two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
pam_service_name=vsftpd  # PAM认证服务的配置文件名称,/etc/pam.d/vsftpd
userlist_enable=YES  # FTP将检查userlist_file(/etc/vsftpd/user_list)中用户是否可以访问FTP服务器
tcp_wrappers=YES  # 使用tcp_wrappers作为主机访问控制方式,/etc/host.allow和/etc/hosts.deny。

精简一下没有注释的版本:(其实我没找到要修改的,压根就没改动)

anonymous_enable=YES             //是否允许匿名访问,匿名帐户为 ftp和 anonymous

local_enable=YES                 //是否允许本地用户访问

write_enable=YES                 //允许本地用户访问时,是否允许他们有写入的权限

local_umask=022                  //本地用户在写入文件时,这些文件默认的权限

dirmessage_enable=YES

xferlog_enable=YES                //是否启用日志

xferlog_std_format=YES            //是否用标准格式存储日志

connected_from_port_20=YES       //是否允许从20的连接请求

pam_service_name=vsftpd          //设置PAM认证服务的配置文件名,该文件位于/etc/pam.d目录下

listen=YES                      //FTP处于独立启动模式

tcp_wraapers=YES                //该服务器使用tcp_wrappers作为主机访问控制方式

userlist_enable=YES             //是否检查vsftpd.user_list中的设置,该文件在/etc下.(在RHEL5中

                                  该文件位于/etc/vsftpd中,文件名为user_list

userlist_deny=YES               //该项与上一项一起构成了黑名单,即在vsftpd.user_list中的用户不

                                  允许访问该FTP服务器.当该项设置为NO时,vsftpd.user_list则为白

                                  名单,即只允许在vsftpd.user_list中的用户访问该FTP服务器.

chroot_local_user=YES             //本地用户登陆时,将其禁锢在FTP根目录下

chroot_list_file=/etc/vsftpd/chroot_list         //该项和上一项配合使用,当该项不存在时,设置上

                                                  一项为YES后,则所有本地用户都被禁锢在FTP根

                                                目录下,该项存在时,则只有该文件中的用户被禁锢

max_clients=100                 //FTP服务器的最大并发连接数

max_per_ip=5                    //每个ip最多建5个连接

local_max_rate=50000                  //本地用户的最大传输速率,单位为B/s

anon_max_rate=10000                    //匿名用户的最大传输速率,单位为B/s

 

3.启动vsftpd,运行FTP服务

service vsftpd restart

如果想让FTP服务器在系统启动时就提供服务,则需要修改其在系统级别下的运行 状态

chkconfig --list vsftpd         //查看在不同系统级别下,vsftpd的运行状态

chkconfig --level 35 vsftpd on   //设置vsftpd在3 5 系统级别下自动运行

简单的FTP服务配置就完成了,在FTP配置过程中,FTP的主配置文件中有启用匿名帐户写入权限项,但是无论该项如何设置都不能让匿名登陆帐户有写入权限.

 

附加:(仅作为额外练习) /etc/vsftpd.user_list文件配置
[root@linux01 ~]# cd /etc/vsftpd
root@linux01 vsftpd]# ls
ftpusers user_list vsftpd.conf vsftpd_conf_migrate.sh
[root@linux01 vsftpd]# cat 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@linux01 vsftpd]#
(当vsftp.conf配置文件中包括以下配置时,user_list中用户帐号禁止登录配置: (黑名单功能)
userlist_enable=YES # 注意大小写
userlist_deny=YES  

当vsftp.conf配置文件中包括以下配置时,只有user_list中用户帐号允许登录配置:注意考虑ftpusers文件用户(白名单功能,只有在此表中的用户可以访问,其他的人都不可以)
userlist_enable=YES # 注意大小写
userlist_deny=NO

)
[root@linux01 vsftpd]# cat 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@linux01 vsftpd]#
4、匿名用户登录目录
匿名用户将进入/var/ftp目录

更加详细的ftp操作请参照:http://blog.csdn.net/changyanmanman/article/details/7646307

相关文章
|
5天前
|
监控 安全 网络安全
漏洞扫描系统可以用于发现网络入侵者?
漏洞扫描系统自动检测系统安全漏洞,如未打补丁软件和弱密码,但无法直接发现网络入侵者。入侵者可能使用加密和掩盖手段逃避检测。为此,需结合入侵检测系统(IDS)、防火墙、安全事件管理(SIEM)系统和蜜罐等工具实时监控异常行为。企业还应提升员工安全意识以增强防御能力。
|
3天前
|
Linux 网络安全
CentOS系统openssh-9,网络安全大厂面试真题解析大全
CentOS系统openssh-9,网络安全大厂面试真题解析大全
|
5天前
|
机器学习/深度学习 传感器 算法
LabVIEW开发基于神经网络的自动汽车制动系统
LabVIEW开发基于神经网络的自动汽车制动系统
|
5天前
|
机器学习/深度学习 人工智能 算法
构建未来:AI驱动的自适应网络安全防御系统
【5月更文挑战第11天】在数字时代的风口浪尖,网络安全问题日益凸显。传统的安全防御手段在应对不断进化的网络威胁时显得力不从心。本文提出了一个基于人工智能技术的自适应网络安全防御系统框架,旨在通过实时分析、学习和预测网络行为,自动调整防御策略以抵御未知攻击。系统采用先进的机器学习算法和大数据分析技术,能够在保持高效性能的同时,最小化误报率。文章详细阐述了系统的设计理念、关键技术组件以及预期效果,为网络安全的未来发展方向提供新思路。
|
5天前
|
网络协议 网络安全 数据库
LabVIEW中MAX在我的网络上不显示“远程系统”选项卡或设备
LabVIEW中MAX在我的网络上不显示“远程系统”选项卡或设备
10 0
|
5天前
|
机器学习/深度学习 人工智能 安全
构建未来:AI驱动的自适应网络安全防御系统
【5月更文挑战第8天】 随着网络攻击的不断演变,传统的安全措施已不足以应对日益复杂的威胁。本文提出了一种基于人工智能(AI)的自适应网络安全防御系统,旨在通过实时分析网络流量和行为模式来自动调整安全策略。系统利用深度学习算法识别潜在威胁,并通过强化学习优化防御机制。初步实验表明,该系统能够有效提高检测率,减少误报,并在未知攻击面前展现出较强的适应性。
24 1
|
5天前
|
机器学习/深度学习 存储 算法
m基于Yolov2深度学习网络的螺丝检测系统matlab仿真,带GUI界面
MATLAB 2022a中展示了YOLOv2算法的螺丝检测仿真结果,该系统基于深度学习的YOLOv2网络,有效检测和定位图像中的螺丝。YOLOv2通过批标准化、高分辨率分类器等优化实现速度和精度提升。核心代码部分涉及设置训练和测试数据,调整图像大小,加载预训练模型,构建YOLOv2网络并进行训练,最终保存检测器模型。
25 3
|
5天前
|
机器学习/深度学习 自动驾驶 安全
基于深度学习的图像识别技术在自动驾驶系统中的应用网络安全与信息安全:防御前线的关键技术与意识
【4月更文挑战第30天】随着人工智能技术的飞速发展,深度学习已成为推动多个技术领域革新的核心力量。特别是在图像识别领域,深度学习模型已展现出超越传统算法的性能。在自动驾驶系统中,准确的图像识别是确保行车安全和高效导航的基础。本文将探讨深度学习在自动驾驶中图像识别的应用,分析关键技术挑战,并提出未来的发展方向。
|
5天前
|
存储 监控 安全
【亮剑】指导初学者如何搭建和使用网络视频监控系统。
【4月更文挑战第30天】本文指导初学者如何搭建和使用网络视频监控系统。核心设备包括摄像头(如固定、PTZ、多目、夜视)、存储选项(NVR、DVR、云存储)及网络交换机等。安装配置步骤涉及规划布局、安装摄像头、设置存储设备和软件配置。实时监控包括实时查看、接收警报和录像回放。理解设备功能、合理布局并细心操作,就能建立稳定监控体系。随着技术进步,未来监控系统将更智能、高效,保障安全。
|
5天前
|
机器学习/深度学习 数据采集 安全
基于机器学习的网络安全威胁检测系统
【4月更文挑战第30天】 随着网络技术的迅猛发展,网络安全问题日益凸显。传统的安全防御机制在应对复杂多变的网络攻击时显得力不从心。为了提高威胁检测的准确性和效率,本文提出了一种基于机器学习的网络安全威胁检测系统。该系统通过集成多种数据预处理技术和特征选择方法,结合先进的机器学习算法,能够实时识别并响应各类网络威胁。实验结果表明,与传统方法相比,本系统在检测率、误报率以及处理速度上均有显著提升,为网络安全管理提供了一种新的技术手段。

推荐镜像

更多