redhat网络安装系统 之二

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

#description:The 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。

启动后利用匿名账户进行测试,如果测试成功您就可以将RHEL4的5张光盘中的所有安装文件全部拷贝到匿名用户的文件夹/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

时间: 2024-09-03 07:44:38

redhat网络安装系统 之二的相关文章

redhat网络安装系统 之一

1.原理部分 许多管理人员在网络管理中,非常头疼的问题就是为用户进行安装操作系统.许多企业的客户端配置基本上很少有带cd-rom,也不可能所有客户端都有操作系统安装光盘.笔者经常发现许多维护人员手拿光驱.光盘来为用户重新进行或升级操作系统.为解决这一枯燥而又重复的工作,不少企业建立了windows远程安装服务器与Linux远程安装服务器.在这里主要探讨一下关于Linux方面的远程安装过程及实现.     在安装过程中Linux首先需要一个引导程序来让安装程序启动,再实行配置与安装.远程网络安装那

redhat网络安装系统 之三

5.  PXE引导配置     要配置TFTP所要传输的bootstrap,首先要准备好引导文件.内核镜像文件.跟文件系统文件. 1. bootstrap文件:pxelinux.0  文件位置在/usr/lib/syslinux目录中.将其拷贝到/tftpboot目录中  #cp /usr/lib/syslinux /pxelinux.0 /tftpboot  2 .内核镜像文件(用于网络启动的内核文件):vmlinuz       vmlinuz文件在RH5镜像文件下的/images/pxeb

网络安装linux系统(二)

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://navyaijm.blog.51cto.com/4647068/861640 之前有些过一篇关于从光驱启动实现网络安装的博文,今天写这篇网络安装的方法超级简单,超级方便使用,比网上其他方法简单多了,环境不到两分钟搭好,不像网上大多数方法,安装这个,安装那个的,麻烦,我这种方法什么都不需要安装,不罗嗦了,看步骤吧: 一.需求 公司新采购了50台dell R610服务器,统一都需要安

Redhat Enterprise Linux 6 Update 4在z/VM 6.2上的快速网络安装方式

在z/VM上部署zLinux有多种方式,本文介绍了Redhat Enterprise Linux 6 Update 4在z/VM 6.2上一种快速的网络安装方式. 1 准备工作 1.1 基础要求 在阅读本文以下内容之前,您需要掌握基础的z/VM CP和CMS命令,请参阅参考资料[3],了解z/VM基本操作.本文假定您已经掌握z/VM基础操作. 1.2 需要的客户端 请准备以下客户端: 3270终端客户端. Linux系统上您可以使用x3270,Windows系统上您可以使用IBM Persona

利用B/S网络安装客户端实现自动分发系统的原理及方法

客户端|网络 /*Author:yekin-yu Date:10/30/2003利用B/S网络安装客户端实现自动分发系统的原理及方法本站作品版权作者所有,其他网站或媒体如要转载请署名作者和出处!*/ 一.用VC++写一个动态链接库文件如Install.dll 实现功能: 1.自动更改IE的安全级别启用未签名的ActiveX控件为安装可执行exe文件做好准备; 2.自动判断浏览者受控端是否安装了客户端安装程序: 3.自动判断浏览者的操作系统,而转向相应的客户端程序安装界面: 4.自动判断受控端的客

redhat或debian系统上软件安装和卸载的介绍

在使用redhat或debian系统中,经常会对软件进行安装和卸载,下面风信网针对Linux系统中的软件的安装和卸载方法进行一个总结,给大家参考使用. 以下示例以rpm包为准!没有安装debian系统,但方法差不多. 卸载一个软件包: rpm -e <package-http://www.aliyun.com/zixun/aggregation/11696.html">name> 示例: [root@localhost software]# rpm -e gnome-libs-

轻松搭建网络办公平台:71BASE-OFFICE网络办公系统v1.3

网络|网络办公 搭建网络办公平台1 [ 作者:孙成 转贴自:本站原创 点击数:60 更新时间:2003-12-11 文章录入:tjrao ] 局域网中轻松搭建网络办公平台 网络迅速发展的今天,电子商务.电子政务在企业和机关单位迅速普及,网络办公已经成为现代办公的主流,它不但提高了员工的工作效率,而且减少了办公费用的支出,这种以网络为媒介的办公就是我们常说的"无纸办公",所有的日常工作以及员工间的相互协作都是在网络中完成的,下面我们就使用"71BASE-OFFICE网络办公系统

kickstart无人值守安装系统

一.使用yum安装dhcp tftp vsftpd system-config-kickstart软件包 1. 安装相关软件包 #yum -y install tftp dhcp vsftpd system-config-kickstart 二.配置dhcpd服务 cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf #vim /etc/dhcpd.conf  内容如下,当然也可以根据自己的需要灵活修改 ddns-updat

优云automation轻松“一点”,搞定裸机安装系统

企业在新建数据中心.新业务上线.老业务扩容等场景下,会采购一批新的裸机服务器,在新服务器投入使用之前,势必得进行操作系统的安装.相信每个人都有安装操作系统的经历,BIOS设置.磁盘分区.驱动安装...,是不是头都大了?传统的人工方式麻烦.耗时.且有一定难度,一般人员无法顺利安装,势必给企业带来一些额外的开销. 幸运的是,福利来了! 现在,您只需将购买到的服务器插上电,告诉优云Automation需要安装的操作系统类型和其他一些简单参数,Automation便能自动收集服务器硬件信息,帮您完成指定