<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Yousri&#039;s Blog &#187; 操作系统</title>
	<atom:link href="http://blog.yousri.org/category/operating-system/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.yousri.org</link>
	<description></description>
	<lastBuildDate>Fri, 14 May 2010 16:29:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>安装配置基于KBS程序的BBS系统</title>
		<link>http://blog.yousri.org/2009/05/16/%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e5%9f%ba%e4%ba%8ekbs%e7%a8%8b%e5%ba%8f%e7%9a%84bbs%e7%b3%bb%e7%bb%9f.html</link>
		<comments>http://blog.yousri.org/2009/05/16/%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e5%9f%ba%e4%ba%8ekbs%e7%a8%8b%e5%ba%8f%e7%9a%84bbs%e7%b3%bb%e7%bb%9f.html#comments</comments>
		<pubDate>Sat, 16 May 2009 15:00:55 +0000</pubDate>
		<dc:creator>Yousri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[服务配置]]></category>
		<category><![CDATA[bbs]]></category>
		<category><![CDATA[kbs]]></category>

		<guid isPermaLink="false">http://qingxianyan.cn/?p=328</guid>
		<description><![CDATA[注：此文备录 相关信息来自网络 记录备用下并时刻更新 操作系统环境：VM虚拟机下的Ubuntu8.04 Server 只安装OpenSSH服务 KBS BBS： kbs svn上最新的源代码 Apache：apache1.3.41.tar.gz (下载：http://www.apache.org） PHP：php5.2.6.tar.gz（下载：http://www.php.net） 代码目录:/home/bbs/src/ 安装前准备工作：更新安装时可能所需要的包： # apt-get install automake1.9 # apt-get install php5-dev # apt-get install libmysqlclient15-dev # apt-get install sendmail # apt-get install libesmtp5 # apt-get install byacc # apt-get install libgmp3-dev # apt-get install flex # apt-get install libxml2-dev # apt-get install libjpeg62-dev [...]]]></description>
			<content:encoded><![CDATA[<p>注：此文备录 相关信息来自网络 记录备用下并时刻更新<br />
操作系统环境：VM虚拟机下的Ubuntu8.04 Server 只安装OpenSSH服务<br />
KBS BBS： kbs svn上最新的源代码<br />
Apache：apache1.3.41.tar.gz (下载：<a href="http://www.apache.org">http://www.apache.org</a>）<br />
PHP：php5.2.6.tar.gz（下载：<a href="http://www.php.net">http://www.php.net</a>）<br />
代码目录:/home/bbs/src/ </p>
<p>安装前准备工作：更新安装时可能所需要的包：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># apt-get install automake1.9</span>
<span style="color: #666666; font-style: italic;"># apt-get install php5-dev</span>
<span style="color: #666666; font-style: italic;"># apt-get install libmysqlclient15-dev</span>
<span style="color: #666666; font-style: italic;"># apt-get install sendmail</span>
<span style="color: #666666; font-style: italic;"># apt-get install libesmtp5</span>
<span style="color: #666666; font-style: italic;"># apt-get install byacc</span>
<span style="color: #666666; font-style: italic;"># apt-get install libgmp3-dev</span>
<span style="color: #666666; font-style: italic;"># apt-get install flex</span>
<span style="color: #666666; font-style: italic;"># apt-get install libxml2-dev</span>
<span style="color: #666666; font-style: italic;"># apt-get install libjpeg62-dev</span>
<span style="color: #666666; font-style: italic;"># apt-get install libpng12-dev</span>
<span style="color: #666666; font-style: italic;"># apt-get install libfreetype6-dev</span>
<span style="color: #666666; font-style: italic;"># apt-get install subversion</span></pre></div></div>

<p>创建bbs用户：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;"># adduser bbs</span></pre></div></div>

<p>安装apache服务：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># tar xvf apache_1.3.41.tar.gz</span>
<span style="color: #666666; font-style: italic;"># cd apache_1.3.41</span>
<span style="color: #666666; font-style: italic;"># CC=&quot;gcc&quot; OPTIM=&quot;-O2&quot; ./configure --prefix=/home/bbs/www --enable-module=so</span>
<span style="color: #666666; font-style: italic;"># make</span>
<span style="color: #666666; font-style: italic;"># make install</span></pre></div></div>

<p>编辑apache的配置文件，User和Group都改成bbs，Port改成想要的端口。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /home/bbs/www/conf</span>
<span style="color: #666666; font-style: italic;"># vim httpd.conf</span></pre></div></div>

<p>安装PHP</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># tar xvf php-5.2.6.tar.gz</span>
<span style="color: #666666; font-style: italic;"># cd php-5.2.6</span>
<span style="color: #666666; font-style: italic;"># ./configure --with-mysql --with-apxs=/home/bbs/www/bin/apxs \\</span>
<span style="color: #660033;">--with-gd</span> <span style="color: #660033;">--with-png-dir</span> <span style="color: #660033;">--with-iconv</span> <span style="color: #660033;">--with-jpeg-dir</span> \\
<span style="color: #660033;">--with-zlib</span> <span style="color: #660033;">--with-ttf</span> <span style="color: #660033;">--with-freetype-dir</span> <span style="color: #660033;">--enable-gd-native-ttf</span>
<span style="color: #666666; font-style: italic;"># make</span>
<span style="color: #666666; font-style: italic;"># make install</span></pre></div></div>

<p>编辑apache的配置文件/home/bbs/www/conf/httpd.conf，在里面加入这样一行：</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">AddType</span> application/x-httpd-php .php</pre></div></div>

<p>下载安装KBS<br />
从kbs的svn服务器上下载最新的kbs源代码。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /home/bbs/src</span>
<span style="color: #666666; font-style: italic;"># svn co http://svn.kcn.cn/repos/kbs/trunk/kbs_bbs</span>
<span style="color: #666666; font-style: italic;"># svn co http://svn.kcn.cn/repos/kbs/trunk/www2</span></pre></div></div>

<p>查看bbs用户的gid和uid是多少。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cat /etc/passwd | grep bbs</span></pre></div></div>

<p>到kbs的站点定义目录下，建造一份自己的站点的定义文件，比如站点叫做Yousri。尤其要修改Yousri.h中的BBSUID和BBSGID为刚才看到的bbs用户的编号。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /home/bbs/src/kbs_bbs/site</span>
<span style="color: #666666; font-style: italic;"># cp fb2k-v2.h yousri.h</span>
<span style="color: #666666; font-style: italic;"># cp fb2k-v2.c yousri.c</span>
<span style="color: #666666; font-style: italic;"># vim yousri.h</span>
运行autogen.sh。
<span style="color: #000000; font-weight: bold;">&lt;</span>pre <span style="color: #007800;">lang</span>=<span style="color: #ff0000;">&quot;bash&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #666666; font-style: italic;"># cd /home/bbs/src/kbs_bbs</span>
<span style="color: #666666; font-style: italic;"># ./autogen.sh</span>
<span style="color: #666666; font-style: italic;"># cd sshbbsd</span>
<span style="color: #666666; font-style: italic;"># ./autogen.sh</span></pre></div></div>

<p>编译安装kbs。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /home/bbs/src/kbs_bbs</span>
<span style="color: #666666; font-style: italic;"># ./configure --prefix=/home/bbs --enable-site=yousri \\</span>
<span style="color: #660033;">--with-php</span> <span style="color: #660033;">--with-mysql</span> <span style="color: #660033;">--enable-ssh</span> <span style="color: #660033;">--enable-ssl</span> \\
<span style="color: #660033;">--with-openssl</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--with-libesmtp</span> <span style="color: #660033;">--enable-innbbsd</span> <span style="color: #007800;">CFLAGS</span>=<span style="color: #ff0000;">&quot;-O3 -g&quot;</span>
<span style="color: #666666; font-style: italic;"># make</span>
<span style="color: #666666; font-style: italic;"># make install</span></pre></div></div>

<p>如果是新建的bbs站点，还需要安装默认的站点文件。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># make install-home</span></pre></div></div>

<p>给sshbbsd生成钥匙。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /home/bbs/etc</span>
<span style="color: #666666; font-style: italic;"># touch sshd_config</span>
<span style="color: #666666; font-style: italic;"># ssh-keygen -t rsa1 -f ssh_host_key</span></pre></div></div>

<p>从php源码目录复制来一个php的配置文件，并编辑之。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /usr/local/lib</span>
<span style="color: #666666; font-style: italic;"># cp /home/bbs/src/php-5.2.6/php.ini-dist php.ini</span>
<span style="color: #666666; font-style: italic;"># vim php.ini</span></pre></div></div>

<p>修改extension_dir一行为：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">extension_dir <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/usr/local/lib/php/extensions/no-debug-non-zts-20060613/&quot;</span></pre></div></div>

<p>然后加入下面一行：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">extension<span style="color: #339933;">=</span>libphpbbslib<span style="color: #339933;">.</span>so</pre></div></div>

<p>把www2符号连接到apache的网页目录来。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /home/bbs/www/</span>
<span style="color: #666666; font-style: italic;"># mv htdocs htdocs.default</span>
<span style="color: #666666; font-style: italic;"># ln -s ../src/www2 htdocs</span></pre></div></div>

<p>因为之前很多操作需要用root执行，可能bbs的很多文件的owner和group不对，所以一并搞掉。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># chown -R bbs:bbs /home/bbs</span></pre></div></div>

<p>启动BBS:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /home/bbs/bin</span>
<span style="color: #666666; font-style: italic;"># ./miscd daemon</span>
<span style="color: #666666; font-style: italic;"># ./bbslogd</span>
<span style="color: #666666; font-style: italic;"># ./bbsd -p 23</span>
<span style="color: #666666; font-style: italic;"># ./sshbbsd -p 22</span>
<span style="color: #666666; font-style: italic;"># cd ../www/bin</span>
<span style="color: #666666; font-style: italic;"># ./apachectl start</span></pre></div></div>

<p>如果要停止bbs的话按如下操作：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /home/bbs/www/bin</span>
<span style="color: #666666; font-style: italic;"># ./apachectl stop</span>
<span style="color: #666666; font-style: italic;"># cd ../../bin</span>
<span style="color: #666666; font-style: italic;"># killall sshbbsd</span>
<span style="color: #666666; font-style: italic;"># killall bbsd</span>
<span style="color: #666666; font-style: italic;"># killall bbslogd</span>
<span style="color: #666666; font-style: italic;"># ./miscd flush</span>
<span style="color: #666666; font-style: italic;"># killall miscd</span></pre></div></div>

<p>其中期间遇到过两个比较莫名其妙的小问题<br />
到最后启动bbs的时候 执行</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>yousri:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>bbs<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #666666; font-style: italic;"># ./miscd daemon</span>
Bus error</pre></div></div>

<p>这一步的时候出现如此的错误提示<br />
还有就是启动后 telnet 127.0.0.1 进入要注册出现无法注册的现象如注册SYSOP账号却提示<br />
“由于某些系统原因, 无法注册新的帐号.”<br />
然后要再次连接 telnet 127.0.0.1 就无法连接了</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">“root<span style="color: #000000; font-weight: bold;">@</span>yousri:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>bbs<span style="color: #666666; font-style: italic;"># telnet 127.0.0.1</span>
  Trying 127.0.0.1...
  Connected to 127.0.0.1.
  Escape character is <span style="color: #ff0000;">'^]'</span>.
  Connection closed by foreign host.”</pre></div></div>

<p>至于执行./miscd daemon报错的问题 后来又重新编译安装了下kbs代码 倒是可行了。。。<br />
对于无法注册账号的  貌似要杀掉有关miscd及bbslogd的进程 然后重新创建才可以 即：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">killall</span> miscd
<span style="color: #c20cb9; font-weight: bold;">killall</span> bbslogd</pre></div></div>

<p>终于正常了。。。。<br />
其他系统使用待更新。。。。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yousri.org/2009/05/16/%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e5%9f%ba%e4%ba%8ekbs%e7%a8%8b%e5%ba%8f%e7%9a%84bbs%e7%b3%bb%e7%bb%9f.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DNS服务器调试工具dig、host、nslookup</title>
		<link>http://blog.yousri.org/2009/04/20/dns%e6%9c%8d%e5%8a%a1%e5%99%a8%e8%b0%83%e8%af%95%e5%b7%a5%e5%85%b7dig%e3%80%81host%e3%80%81nslookup.html</link>
		<comments>http://blog.yousri.org/2009/04/20/dns%e6%9c%8d%e5%8a%a1%e5%99%a8%e8%b0%83%e8%af%95%e5%b7%a5%e5%85%b7dig%e3%80%81host%e3%80%81nslookup.html#comments</comments>
		<pubDate>Sun, 19 Apr 2009 16:11:13 +0000</pubDate>
		<dc:creator>Yousri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[网络管理]]></category>
		<category><![CDATA[dig]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[host]]></category>
		<category><![CDATA[nslookup]]></category>

		<guid isPermaLink="false">http://qingxianyan.cn/?p=283</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160; 先前曾经简单介绍过在CentOS5.2下搭建实现DNS服务器，可查看这里 &#160;&#160;&#160;&#160;&#160;&#160; 现在就再简单大致记录介绍三款常用于检查测试调试DNS服务器搭建是否成功的工具吧～即Dig、Host、Nslookup，介绍： &#160;&#160;&#160;&#160;&#160;&#160; Shell方式可以使用3种工具来查询DNS数据库：nslookup、dig和host，在BIND的软件发布中包括nslookup和dig。 Nslookup是这三个工具中最老的，而且总是随同BIND一起发布;dig是域信息的探索程序，最初由SteveHotz编写，后来 MichaelSawy针对BIND 9将它重新编写，它也和BIND一起发布;host由Eric Wassenaar编写，是另一个开放源代码的工具，其特点是输出对用户很友好，功能是可检查区文件的语法。另外三者使用的解析器库不同：dig和 host使用BIND的解析器，而nslookup有其自身的解析器。 &#160;&#160;&#160;&#160;&#160;&#160; （1）、Dig命令 Usage:&#160; dig [@global-server] [domain] [q-type] [q-class] {q-opt} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {global-d-opt} host [@local-server] {local-d-opt} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; [ host [@local-server] {local-d-opt} [...]] &#160;&#160;&#160;&#160;&#160;&#160; 以上是关于dig用法参数列表，可以通过man dig 或者 dig &#8211;h &#124; more 查看其命令相应的帮助信息～ 参数可接IP address或domain name来获得name server所提供的相关讯息，提供不同资料记录型态，例如A、MX&#8230;等等 &#160;&#160;&#160;&#160;&#160; （2）、Host命令 [root@yanqx ~]$ host -h&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; host: illegal option &#8212; h [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 先前曾经简单介绍过在CentOS5.2下搭建实现DNS服务器，可查看<a href="http://qingxianyan.cn/2009/02/21/centos52%E6%90%AD%E5%BB%BA%E9%85%8D%E7%BD%AEdns%E6%9C%8D%E5%8A%A1.html" target="_blank">这里</a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 现在就再简单大致记录介绍三款常用于检查测试调试DNS服务器搭建是否成功的工具吧～即Dig、Host、Nslookup，介绍：</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
Shell方式可以使用3种工具来查询DNS数据库：nslookup、dig和host，在BIND的软件发布中包括nslookup和dig。<br />
Nslookup是这三个工具中最老的，而且总是随同BIND一起发布;dig是域信息的探索程序，最初由SteveHotz编写，后来<br />
MichaelSawy针对BIND 9将它重新编写，它也和BIND一起发布;host由Eric<br />
Wassenaar编写，是另一个开放源代码的工具，其特点是输出对用户很友好，功能是可检查区文件的语法。另外三者使用的解析器库不同：dig和<br />
host使用BIND的解析器，而nslookup有其自身的解析器。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; （1）、Dig命令</p>
<blockquote>
<p>Usage:&nbsp; dig [@global-server] [domain] [q-type] [q-class] {q-opt}     <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {global-d-opt} host [@local-server] {local-d-opt}      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ host [@local-server] {local-d-opt} [...]]</p>
</blockquote>
<p><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
以上是关于dig用法参数列表，可以通过man dig 或者 dig &ndash;h | more 查看其命令相应的帮助信息～ 参数可接IP<br />
address或domain name来获得name server所提供的相关讯息，提供不同资料记录型态，例如A、MX&hellip;等等</span></p>
<p><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; （2）、Host命令</span></p>
<blockquote>
<p>[root@yanqx ~]$ host -h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />host: illegal option &mdash; h      <br />Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [-R number] hostname [server]      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -a is equivalent to -v -t *      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -c specifies query class for non-IN data      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -C compares SOA records on authoritative nameservers      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -d is equivalent to -v      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -l lists all hosts in a domain, using AXFR      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -i IP6.INT reverse lookups      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -N changes the number of dots allowed before root lookup is done      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -r disables recursive processing      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -R specifies number of retries for UDP packets      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -t specifies the query type      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -T enables TCP/IP mode      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -v enables verbose output      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -w specifies to wait forever for a reply      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -W specifies how long to wait for a reply      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -4 use IPv4 query transport only      <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -6 use IPv6 query transport only</p>
</blockquote>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 默认情况下，只是简单使用host+欲查询域名得到只是简单一些A记录或MX记录等，想了解全部信息需加上 &ndash;a 参数查看 如：</p>
<blockquote>
<p>[root@yanqx ~]$ host qingxianyan.cn     <br />qingxianyan.cn has address 74.220.219.76      <br />qingxianyan.cn mail is handled by 0 qingxianyan.cn.</p>
</blockquote>
<p><span>&nbsp;&nbsp; （3）、Nslookup命令</span></p>
<p><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在linux或win下</span>输<br />
入nslookup命令后，会看到 &gt; 提示符号，之后就可输入查询指令。一般会输入IP address或是domain<br />
name来做反向及正向的解析。而nslookup不仅提供上述2种解析，亦像dig提供DNS中其它的资料记录型态，例如A、MX、NS&hellip;等等，可在提<br />
示符号直接输入&rdquo;?&rdquo;来获得所有可以使用的参数或资料型态。</p>
<blockquote>
<p>Commands:&nbsp;&nbsp; (identifiers are shown in uppercase, [] means optional)     <br />NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; print info about the host/domain NAME using default server      <br />NAME1 NAME2&nbsp;&nbsp;&nbsp;&nbsp; &#8211; as above, but use NAME2 as server      <br />help or ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; print info on common commands      <br />set OPTION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; set an option      <br />&nbsp;&nbsp;&nbsp; all&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; print options, current server and host      <br />&nbsp;&nbsp;&nbsp; [no]debug&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; print debugging information      <br />&nbsp;&nbsp;&nbsp; [no]d2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; print exhaustive debugging information      <br />&nbsp;&nbsp;&nbsp; [no]defname&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; append domain name to each query      <br />&nbsp;&nbsp;&nbsp; [no]recurse&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; ask for recursive answer to query      <br />&nbsp;&nbsp;&nbsp; [no]search&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; use domain search list      <br />&nbsp;&nbsp;&nbsp; [no]vc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; always use a virtual circuit      <br />&nbsp;&nbsp;&nbsp; domain=NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; set default domain name to NAME      <br />&nbsp;&nbsp;&nbsp; srchlist=N1[/N2/.../N6] &#8211; set domain to N1 and search list to N1,N2, etc.      <br />&nbsp;&nbsp;&nbsp; root=NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; set root server to NAME      <br />&nbsp;&nbsp;&nbsp; retry=X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; set number of retries to X      <br />&nbsp;&nbsp;&nbsp; timeout=X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; set initial time-out interval to X seconds      <br />&nbsp;&nbsp;&nbsp; type=X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; set query type (ex. A,ANY,CNAME,MX,NS,PTR,SOA,SRV)      <br />&nbsp;&nbsp;&nbsp; querytype=X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; same as type      <br />&nbsp;&nbsp;&nbsp; class=X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; set query class (ex. IN (Internet), ANY)      <br />&nbsp;&nbsp;&nbsp; [no]msxfr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; use MS fast zone transfer      <br />&nbsp;&nbsp;&nbsp; ixfrver=X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; current version to use in IXFR transfer request      <br />server NAME&nbsp;&nbsp;&nbsp;&nbsp; &#8211; set default server to NAME, using current default server      <br />lserver NAME&nbsp;&nbsp;&nbsp; &#8211; set default server to NAME, using initial server      <br />finger [USER]&nbsp;&nbsp; &#8211; finger the optional NAME at the current default host      <br />root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; set current default server to the root      <br />ls [opt] DOMAIN [&gt; FILE] &#8211; list addresses in DOMAIN (optional: output to FILE)      <br />&nbsp;&nbsp;&nbsp; -a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp; list canonical names and aliases      <br />&nbsp;&nbsp;&nbsp; -d&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp; list all records      <br />&nbsp;&nbsp;&nbsp; -t TYPE&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp; list records of the given type (e.g. A,CNAME,MX,NS,PTR etc.)      <br />view FILE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; sort an &lsquo;ls&rsquo; output file and view it with pg      <br />exit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; exit the program</p>
</blockquote>
<p>&nbsp;&nbsp;&nbsp;&nbsp; 参考资料：<a title="http://docsrv.sco.com/NET_tcpip/dnsC.nslook.html" href="http://docsrv.sco.com/NET_tcpip/dnsC.nslook.html" target="_blank">http://docsrv.sco.com/NET_tcpip/dnsC.nslook.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yousri.org/2009/04/20/dns%e6%9c%8d%e5%8a%a1%e5%99%a8%e8%b0%83%e8%af%95%e5%b7%a5%e5%85%b7dig%e3%80%81host%e3%80%81nslookup.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>查看硬件信息工具lshw及查找打开的文件工具lsof</title>
		<link>http://blog.yousri.org/2009/03/26/%e6%9f%a5%e7%9c%8b%e7%a1%ac%e4%bb%b6%e4%bf%a1%e6%81%af%e5%b7%a5%e5%85%b7lshw%e5%8f%8a%e6%9f%a5%e6%89%be%e6%89%93%e5%bc%80%e7%9a%84%e6%96%87%e4%bb%b6%e5%b7%a5%e5%85%b7lsof.html</link>
		<comments>http://blog.yousri.org/2009/03/26/%e6%9f%a5%e7%9c%8b%e7%a1%ac%e4%bb%b6%e4%bf%a1%e6%81%af%e5%b7%a5%e5%85%b7lshw%e5%8f%8a%e6%9f%a5%e6%89%be%e6%89%93%e5%bc%80%e7%9a%84%e6%96%87%e4%bb%b6%e5%b7%a5%e5%85%b7lsof.html#comments</comments>
		<pubDate>Thu, 26 Mar 2009 09:12:33 +0000</pubDate>
		<dc:creator>Yousri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[脚本编程]]></category>
		<category><![CDATA[lsof]]></category>

		<guid isPermaLink="false">http://qingxianyan.cn/?p=323</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;介绍推荐两款命令系统工具：硬件配置信息查看工具lshw及查看打开的文件和套接字工具lsof &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;lshw硬件查看工具，它全称叫:HardWare LiSter，实现的原理应该可以说是获取使用/proc里面读取到的数据来显示相关的信息 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;下载地址：http://ezix.org/software/files/lshw-B.02.14.tar.gz &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;解压安装：tar -zxvf lshw-B.02.14.tar.gz &#38;&#38; make &#38;&#38; make install 即可 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;可以先了解查看解压后目录下的README文件信息： 1 lshw: HardWare LiSter for Linux 2 =============================== 4 lshw is a small tool to provide detailed information on the hardware confi- 5 guration of the machine. It can report exact memory configuration, firmware 6 version, mainboard configuration, CPU version and [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;介绍推荐两款命令系统工具：硬件配置信息查看工具lshw及查看打开的文件和套接字工具lsof<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lshw硬件查看工具，它全称叫:HardWare LiSter，实现的原理应该可以说是获取使用/proc里面读取到的数据来显示相关的信息<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;下载地址：http://ezix.org/software/files/lshw-B.02.14.tar.gz<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;解压安装：tar -zxvf lshw-B.02.14.tar.gz &amp;&amp; make &amp;&amp; make install 即可<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;可以先了解查看解压后目录下的README文件信息：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #000000;">1</span> lshw: HardWare LiSter <span style="color: #000000; font-weight: bold;">for</span> Linux
    <span style="color: #000000;">2</span> ===============================
    <span style="color: #000000;">4</span> lshw is a small tool to provide detailed information on the hardware confi-
    <span style="color: #000000;">5</span> guration of the machine. It can report exact memory configuration, firmware
    <span style="color: #000000;">6</span> version, mainboard configuration, CPU version and speed, cache configuration,
    <span style="color: #000000;">7</span> bus speed, etc. on DMI-capable x86 or EFI <span style="color: #7a0874; font-weight: bold;">&#40;</span>IA-<span style="color: #000000;">64</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> systems and on some PowerPC
    <span style="color: #000000;">8</span> machines <span style="color: #7a0874; font-weight: bold;">&#40;</span>PowerMac G4 is known to work<span style="color: #7a0874; font-weight: bold;">&#41;</span>.
    <span style="color: #000000;">10</span> Information can be output <span style="color: #000000; font-weight: bold;">in</span> plain text, XML or HTML.
    <span style="color: #000000;">12</span> It currently supports DMI <span style="color: #7a0874; font-weight: bold;">&#40;</span>x86 and EFI only<span style="color: #7a0874; font-weight: bold;">&#41;</span>, OpenFirmware device <span style="color: #c20cb9; font-weight: bold;">tree</span>
    <span style="color: #000000;">13</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>PowerPC only<span style="color: #7a0874; font-weight: bold;">&#41;</span>, PCI<span style="color: #000000; font-weight: bold;">/</span>AGP, ISA PnP <span style="color: #7a0874; font-weight: bold;">&#40;</span>x86<span style="color: #7a0874; font-weight: bold;">&#41;</span>, CPUID <span style="color: #7a0874; font-weight: bold;">&#40;</span>x86<span style="color: #7a0874; font-weight: bold;">&#41;</span>, IDE<span style="color: #000000; font-weight: bold;">/</span>ATA<span style="color: #000000; font-weight: bold;">/</span>ATAPI, PCMCIA
    <span style="color: #000000;">14</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>only tested on x86<span style="color: #7a0874; font-weight: bold;">&#41;</span>, USB and SCSI.
    <span style="color: #000000;">16</span>  <span style="color: #000000; font-weight: bold;">*</span> Requirements
    <span style="color: #000000;">17</span>     . Linux 2.4.x or 2.6.x <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.2.x might work, though<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000;">18</span>     . a PA-RISC, Alpha, IA-<span style="color: #000000;">64</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Itanium<span style="color: #7a0874; font-weight: bold;">&#41;</span>, PowerPC or x86 based machine
    <span style="color: #000000;">19</span>     . an ANSI <span style="color: #7a0874; font-weight: bold;">&#40;</span>or close enough to ANSI compliance<span style="color: #7a0874; font-weight: bold;">&#41;</span> C++ compiler
    <span style="color: #000000;">20</span>     <span style="color: #7a0874; font-weight: bold;">&#40;</span>tested with <span style="color: #c20cb9; font-weight: bold;">g++</span> 2.95.4 and 3.2.2<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000;">21</span>     . <span style="color: #000000; font-weight: bold;">for</span> the <span style="color: #7a0874; font-weight: bold;">&#40;</span>optional<span style="color: #7a0874; font-weight: bold;">&#41;</span> GTK+ graphical user interface, you will need a
    <span style="color: #000000;">22</span>     <span style="color: #7a0874; font-weight: bold;">complete</span> GTK+ <span style="color: #000000;">2.4</span> development environment <span style="color: #7a0874; font-weight: bold;">&#40;</span>gtk2-devel on RedHat<span style="color: #000000; font-weight: bold;">/</span>Fedora
    <span style="color: #000000;">23</span>     derivatives<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000;">25</span>  <span style="color: #000000; font-weight: bold;">*</span> To compile it, just use:
    <span style="color: #000000;">27</span>     $ <span style="color: #c20cb9; font-weight: bold;">make</span>
    <span style="color: #000000;">29</span>  <span style="color: #000000; font-weight: bold;">*</span> If you want to build the optional GUI, <span style="color: #000000; font-weight: bold;">do</span>:
    <span style="color: #000000;">31</span>     $ <span style="color: #c20cb9; font-weight: bold;">make</span>
    <span style="color: #000000;">32</span>     $ <span style="color: #c20cb9; font-weight: bold;">make</span> gui
    <span style="color: #000000;">34</span>  <span style="color: #000000; font-weight: bold;">*</span> the lshw home page is http:<span style="color: #000000; font-weight: bold;">//</span>lshw.org<span style="color: #000000; font-weight: bold;">/</span>
    <span style="color: #000000;">35</span>  <span style="color: #000000; font-weight: bold;">*</span> send bug reports, requests <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">help</span>, feature requests, comments, etc. to
    <span style="color: #000000;">36</span>    bugs<span style="color: #000000; font-weight: bold;">@</span>ezix.org.  The author can be contacted directly <span style="color: #7a0874; font-weight: bold;">&#40;</span>lyonel<span style="color: #000000; font-weight: bold;">@</span>ezix.org<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000;">37</span>    Please <span style="color: #c20cb9; font-weight: bold;">make</span> sure you include enough information <span style="color: #000000; font-weight: bold;">in</span> your bug report:
    XML  <span style="color: #000000;">38</span>    output from lshw is preferred over text or HTML, indicate the affected
    <span style="color: #000000;">39</span>    version of lshw, your platform <span style="color: #7a0874; font-weight: bold;">&#40;</span>i386, x86-<span style="color: #000000;">64</span>, PA-RISC, PowerPC, etc.<span style="color: #7a0874; font-weight: bold;">&#41;</span> and <span style="color: #000000;">40</span>
    your distribution.
    and so on。。。</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;可以使用html格式输出这些信息  通过web浏览查看  如：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">#lshw -html &amp;gt;/var/www/pcinfo.html</span></pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;然后网页 http://yourdomain/pcinfo.html 查看<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;还有更多的相关lshw参数可以使用 也支持图形界面的查看，详见</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">#lshw –X    //图形界面</span>
    <span style="color: #666666; font-style: italic;">#man lshw   // 查看lshw工具更多参数用法</span></pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lsof轻松查看正在运行的进程可打开哪些文、目录及套接字等信息，了解应用程序打开了哪些文件或者哪个应用程序打开了特定的文件，进而了解更多关于系统的信息。<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;快速查出哪个进程在使用某个特定目录（如：/root/install) ，此有助于umount（卸载）或rm（删除）某些文件系统或目录前进行确认，可尝试使用lsof工具：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>yanqx ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># lsof /root/install/</span>
    COMMAND   PID USER   FD   TYPE DEVICE SIZE      NODE NAME
    <span style="color: #c20cb9; font-weight: bold;">bash</span>    <span style="color: #000000;">18041</span> root  cwd    DIR   <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span> <span style="color: #000000;">4096</span> <span style="color: #000000;">188088470</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>install<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;可见得，显然是root进入到了/root/install目录中。。。。<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;同样，lsof也可列举出与特地进程相关联到的文件、目录、库等等信息，如要显示与指定PI进程相关联的文件可使用-p选项：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>yanqx ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># lsof -p 9554</span>
    COMMAND  PID USER   FD   TYPE   DEVICE    SIZE      NODE NAME
    sshd    <span style="color: #000000;">9554</span> root  cwd    DIR     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>    <span style="color: #000000;">4096</span> <span style="color: #000000;">187957388</span> <span style="color: #000000; font-weight: bold;">/</span>
    sshd    <span style="color: #000000;">9554</span> root  rtd    DIR     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>    <span style="color: #000000;">4096</span> <span style="color: #000000;">187957388</span> <span style="color: #000000; font-weight: bold;">/</span>
    sshd    <span style="color: #000000;">9554</span> root  txt    REG     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>  <span style="color: #000000;">409560</span> <span style="color: #000000;">187988270</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>sshd
    sshd    <span style="color: #000000;">9554</span> root  mem    REG     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>  <span style="color: #000000;">132304</span> <span style="color: #000000;">187973604</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>ld-2.5.so
    sshd    <span style="color: #000000;">9554</span> root  mem    REG     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>   <span style="color: #000000;">44472</span> <span style="color: #000000;">187973606</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libpam.so.0.81.5
    sshd    <span style="color: #000000;">9554</span> root  mem    REG     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>   <span style="color: #000000;">20424</span> <span style="color: #000000;">187973386</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libdl-2.5.so
    sshd    <span style="color: #000000;">9554</span> root  mem    REG     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span> <span style="color: #000000;">1750504</span> <span style="color: #000000;">190255826</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libcrypto.so.0.9.8
    sshd    <span style="color: #000000;">9554</span> root  mem    REG     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>   <span style="color: #000000;">15280</span> <span style="color: #000000;">187973406</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libutil-2.5.so
    sshd    <span style="color: #000000;">9554</span> root  mem    REG     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>   <span style="color: #000000;">83344</span> <span style="color: #000000;">187959026</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libz.so.1.2.3
    sshd    <span style="color: #000000;">9554</span> root  mem    REG     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>  <span style="color: #000000;">111480</span> <span style="color: #000000;">187973548</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libnsl-2.5.so
    sshd    <span style="color: #000000;">9554</span> root  mem    REG     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>   <span style="color: #000000;">45728</span> <span style="color: #000000;">187973602</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libcrypt-2.5.so
    sshd    <span style="color: #000000;">9554</span> root  mem    REG     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>   <span style="color: #000000;">89800</span> <span style="color: #000000;">187972006</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libresolv-2.5.so
    sshd    <span style="color: #000000;">9554</span> root  mem    REG     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span> <span style="color: #000000;">1698672</span> <span style="color: #000000;">187973486</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libc-2.5.so
    sshd    <span style="color: #000000;">9554</span> root  mem    REG     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>   <span style="color: #000000;">84400</span> <span style="color: #000000;">187973582</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libaudit.so.0.0.0
    sshd    <span style="color: #000000;">9554</span> root  mem    REG     <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>   <span style="color: #000000;">53880</span> <span style="color: #000000;">187973574</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libnss_files-2.5.so
    sshd    <span style="color: #000000;">9554</span> root    0u   CHR      <span style="color: #000000;">1</span>,<span style="color: #000000;">3</span>          <span style="color: #000000;">12392555</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
    sshd    <span style="color: #000000;">9554</span> root    1u   CHR      <span style="color: #000000;">1</span>,<span style="color: #000000;">3</span>          <span style="color: #000000;">12392555</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
    sshd    <span style="color: #000000;">9554</span> root    2u   CHR      <span style="color: #000000;">1</span>,<span style="color: #000000;">3</span>          <span style="color: #000000;">12392555</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
    sshd    <span style="color: #000000;">9554</span> root    3u  IPv6 <span style="color: #000000;">12393000</span>               TCP <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>LISTEN<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    sshd    <span style="color: #000000;">9554</span> root    4u  IPv4 <span style="color: #000000;">12393002</span>               TCP <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>LISTEN<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;或也可以通过使用-c参数选项，来通过进程名称来指定的进程查看：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>yanqx ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># lsof -c init</span>
    COMMAND PID USER   FD   TYPE DEVICE    SIZE      NODE NAME
    init      <span style="color: #000000;">1</span> root  cwd    DIR   <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>    <span style="color: #000000;">4096</span> <span style="color: #000000;">187957388</span> <span style="color: #000000; font-weight: bold;">/</span>
    init      <span style="color: #000000;">1</span> root  rtd    DIR   <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>    <span style="color: #000000;">4096</span> <span style="color: #000000;">187957388</span> <span style="color: #000000; font-weight: bold;">/</span>
    init      <span style="color: #000000;">1</span> root  txt    REG   <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>   <span style="color: #000000;">40968</span> <span style="color: #000000;">187988546</span> <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>init
    init      <span style="color: #000000;">1</span> root  mem    REG   <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>          <span style="color: #000000;">96280139</span> <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>init <span style="color: #7a0874; font-weight: bold;">&#40;</span>path <span style="color: #007800;">inode</span>=<span style="color: #000000;">187988546</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    init      <span style="color: #000000;">1</span> root  mem    REG   <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>  <span style="color: #000000;">132304</span> <span style="color: #000000;">187973604</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>ld-2.5.so
    init      <span style="color: #000000;">1</span> root  mem    REG   <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>  <span style="color: #000000;">245264</span> <span style="color: #000000;">187973608</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libsepol.so.1
    init      <span style="color: #000000;">1</span> root  mem    REG   <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>   <span style="color: #000000;">92960</span> <span style="color: #000000;">187973474</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libselinux.so.1
    init      <span style="color: #000000;">1</span> root  mem    REG   <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span> <span style="color: #000000;">1698672</span> <span style="color: #000000;">187973486</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libc-2.5.so
    init      <span style="color: #000000;">1</span> root  mem    REG   <span style="color: #000000;">0</span>,<span style="color: #000000;">29</span>   <span style="color: #000000;">20424</span> <span style="color: #000000;">187973386</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libdl-2.5.so
    init      <span style="color: #000000;">1</span> root   10u  FIFO   <span style="color: #000000;">0</span>,<span style="color: #000000;">48</span>          <span style="color: #000000;">12392766</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>initctl</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;关于lsof这工具还可以通过相当多的不同参数进行实现不同功能  这里就不一一列举。。可自己查看工具命令帮助文档了解 嗯<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;对此两工具就简单介绍分享推荐到此////</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yousri.org/2009/03/26/%e6%9f%a5%e7%9c%8b%e7%a1%ac%e4%bb%b6%e4%bf%a1%e6%81%af%e5%b7%a5%e5%85%b7lshw%e5%8f%8a%e6%9f%a5%e6%89%be%e6%89%93%e5%bc%80%e7%9a%84%e6%96%87%e4%bb%b6%e5%b7%a5%e5%85%b7lsof.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>删除Ubuntu的NetworkManager网络管理并手动设置静态IP</title>
		<link>http://blog.yousri.org/2009/03/19/%e5%88%a0%e9%99%a4ubuntu%e7%9a%84networkmanager%e7%bd%91%e7%bb%9c%e7%ae%a1%e7%90%86%e5%b9%b6%e6%89%8b%e5%8a%a8%e8%ae%be%e7%bd%ae%e9%9d%99%e6%80%81ip.html</link>
		<comments>http://blog.yousri.org/2009/03/19/%e5%88%a0%e9%99%a4ubuntu%e7%9a%84networkmanager%e7%bd%91%e7%bb%9c%e7%ae%a1%e7%90%86%e5%b9%b6%e6%89%8b%e5%8a%a8%e8%ae%be%e7%bd%ae%e9%9d%99%e6%80%81ip.html#comments</comments>
		<pubDate>Thu, 19 Mar 2009 08:27:52 +0000</pubDate>
		<dc:creator>Yousri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[网络管理]]></category>
		<category><![CDATA[network manager]]></category>
		<category><![CDATA[网络配置]]></category>

		<guid isPermaLink="false">http://qingxianyan.cn/?p=312</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Ubuntu操作系统安装完成后网络管理默认是用DHCP自动获取IP地址的，之前在自己住宿就一两台机使用反正也没啥差就懒得改为静态固定IP，但是最近在公司使用vm虚拟机下安装了台Ubuntu8.10玩一玩，有时基本使用SecureCRT软件SSH远程登陆使用，但是由于公司使用都是内部动态 IP地址，而且机器较多所以导致IP地址经常性更换，有点烦所以自己决定试图修改成使用静态IP，可是那个可恶的NetworkManager总是在重启后又变成默认的DHCP自动获取IP。。。故决定删除彻底NetworkManager sudo apt-get –purge remove network-manager sudo apt-get –purge remove network-manager-gnome &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;手动设置静态IP地址：编辑修改网络接口配置文件/etc/network/interfaces sudo vim /etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 172.17.4.170 netmask 255.255.255.0 network 172.17.4.1 gateway 172.17.4.3 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;修改设置DNS服务器配置文件/etc/resolv.conf sudo vim /etc/resolv.conf nameserver 202.101.103.54 nameserver 202.101.103.55 nameserver 172.17.4.1 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;最后重启网络服务 sudo /etc/init.d/networking restart &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;这样上网基本就没什么问题啦/// 如果你之前没有删除NetworkManager网络管理的话，重启后/etc/resolv.conf里面的配置文件又会被修改为 # Generated by [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ubuntu操作系统安装完成后网络管理默认是用DHCP自动获取IP地址的，之前在自己住宿就一两台机使用反正也没啥差就懒得改为静态固定IP，但是最近在公司使用vm虚拟机下安装了台Ubuntu8.10玩一玩，有时基本使用SecureCRT软件SSH远程登陆使用，但是由于公司使用都是内部动态 IP地址，而且机器较多所以导致IP地址经常性更换，有点烦所以自己决定试图修改成使用静态IP，可是那个可恶的NetworkManager总是在重启后又变成默认的DHCP自动获取IP。。。故决定删除彻底NetworkManager</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> –purge remove network-manager
    <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> –purge remove network-manager-gnome</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;手动设置静态IP地址：编辑修改网络接口配置文件/etc/network/interfaces</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>network<span style="color: #000000; font-weight: bold;">/</span>interfaces
    auto lo
    iface lo inet loopback
    auto eth0
    iface eth0 inet static
            address 172.17.4.170
            netmask 255.255.255.0
            network  172.17.4.1
            gateway 172.17.4.3</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;修改设置DNS服务器配置文件/etc/resolv.conf</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf
    nameserver 202.101.103.54
    nameserver 202.101.103.55
    nameserver 172.17.4.1</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;最后重启网络服务</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>networking restart</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这样上网基本就没什么问题啦///   如果你之前没有删除NetworkManager网络管理的话，重启后/etc/resolv.conf里面的配置文件又会被修改为</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Generated by NetworkManager</span></pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;导致又是使用DHCP动态分配IP地址的。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yousri.org/2009/03/19/%e5%88%a0%e9%99%a4ubuntu%e7%9a%84networkmanager%e7%bd%91%e7%bb%9c%e7%ae%a1%e7%90%86%e5%b9%b6%e6%89%8b%e5%8a%a8%e8%ae%be%e7%bd%ae%e9%9d%99%e6%80%81ip.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>centos5.2搭建配置dns服务</title>
		<link>http://blog.yousri.org/2009/02/21/centos52%e6%90%ad%e5%bb%ba%e9%85%8d%e7%bd%aedns%e6%9c%8d%e5%8a%a1.html</link>
		<comments>http://blog.yousri.org/2009/02/21/centos52%e6%90%ad%e5%bb%ba%e9%85%8d%e7%bd%aedns%e6%9c%8d%e5%8a%a1.html#comments</comments>
		<pubDate>Sat, 21 Feb 2009 07:10:56 +0000</pubDate>
		<dc:creator>Yousri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[服务配置]]></category>
		<category><![CDATA[DNS]]></category>

		<guid isPermaLink="false">http://qingxianyan.cn/?p=296</guid>
		<description><![CDATA[一、配置环境： &#160;&#160;&#160;&#160;&#160;&#160;&#160;OS：CentOS 5.2 &#160;&#160;&#160;&#160;&#160;&#160;&#160;IP：192.168.1.99 &#160;&#160;&#160;&#160;&#160;&#160;&#160;计算机名：yousri &#160;&#160;&#160;&#160;&#160;&#160;&#160;域名：yousri.com &#160;&#160;&#160;&#160;&#160;&#160;&#160;别名：www.yousri.com 二、检查自己是否已经安装了Bind： &#91;root@yanqx ~&#93;# rpm –qa &#124; grep bind bind-9.3.4-6.P1.el5.i386.rpm bind-libbind-devel-9.3.4-6.P1.el5.i386.rpm bind-sdb-9.3.4-6.P1.el5.i386.rpm bind-devel-9.3.4-6.P1.el5.i386.rpm caching-nameserver-9.3.4-6.P1.el5.i386.rpm bind-chroot-9.3.4-6.P1.el5.i386.rpm &#160;&#160;&#160;&#160;&#160;&#160;&#160;主要检查以上六个包是否有安装： &#160;&#160;&#160;&#160;&#160;&#160;&#160;配置文件修改，主要将涉及到的配置文件包括以下： /etc/sysconfig/network //设置主机名 /etc/sysconfig/network-scripts/ifgcfg-eth0 //设置IP地址 /etc/named.conf //DNS主配置文件 /var/named/chroot/var/named/yousri.com.db //正向解析文件 /var/named/chroot/var/named/1.168.192.db //反向解析文件 /etc/resolv.conf //本机DNS配置文件 /var/named/chroot/var/named/localdomain.zone //正向解析文件模板 /var/named/chroot/var/named/named.local //反向解析文件模板 &#160;&#160;&#160;&#160;&#160;&#160;&#160;关于修改主机名及设置IP地址的配置这里就不多言啦/// 可以上网的话基本都已经配置好啦，可使用hostname查询主机名 三、主配置文件named.conf的配置 &#160;&#160;&#160;&#160;&#160;&#160;&#160;因为主配置文件named.conf包含一句话扩展外包配置文件的记录：include “/etc/named.rfc1912.zones”;故这里在配置定义正向解析文件与反向解析文件 &#91;root@yanqx ~&#93;#vim /var/named/chroot/etc/named.rfc1912.zonesf zone &#34;yousri.com&#34; IN &#123; //定义一个正向域yousri.com type master; file [...]]]></description>
			<content:encoded><![CDATA[<p>一、配置环境：<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OS：CentOS 5.2<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IP：192.168.1.99<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;计算机名：yousri<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;域名：yousri.com<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别名：www.yousri.com</p>
<p>二、检查自己是否已经安装了Bind：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>yanqx ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># rpm –qa | grep bind</span>
bind-9.3.4-6.P1.el5.i386.rpm
bind-libbind-devel-9.3.4-6.P1.el5.i386.rpm
bind-sdb-9.3.4-6.P1.el5.i386.rpm
bind-devel-9.3.4-6.P1.el5.i386.rpm
caching-nameserver-9.3.4-6.P1.el5.i386.rpm
bind-chroot-9.3.4-6.P1.el5.i386.rpm</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;主要检查以上六个包是否有安装：<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;配置文件修改，主要将涉及到的配置文件包括以下：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sysconfig<span style="color: #000000; font-weight: bold;">/</span>network   <span style="color: #000000; font-weight: bold;">//</span>设置主机名
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sysconfig<span style="color: #000000; font-weight: bold;">/</span>network-scripts<span style="color: #000000; font-weight: bold;">/</span>ifgcfg-eth0  <span style="color: #000000; font-weight: bold;">//</span>设置IP地址
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>named.conf    <span style="color: #000000; font-weight: bold;">//</span>DNS主配置文件
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>named<span style="color: #000000; font-weight: bold;">/</span>chroot<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>named<span style="color: #000000; font-weight: bold;">/</span>yousri.com.db   <span style="color: #000000; font-weight: bold;">//</span>正向解析文件
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>named<span style="color: #000000; font-weight: bold;">/</span>chroot<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>named<span style="color: #000000; font-weight: bold;">/</span>1.168.192.db   <span style="color: #000000; font-weight: bold;">//</span>反向解析文件
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf     <span style="color: #000000; font-weight: bold;">//</span>本机DNS配置文件
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>named<span style="color: #000000; font-weight: bold;">/</span>chroot<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>named<span style="color: #000000; font-weight: bold;">/</span>localdomain.zone   <span style="color: #000000; font-weight: bold;">//</span>正向解析文件模板
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>named<span style="color: #000000; font-weight: bold;">/</span>chroot<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>named<span style="color: #000000; font-weight: bold;">/</span>named.local       <span style="color: #000000; font-weight: bold;">//</span>反向解析文件模板</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;关于修改主机名及设置IP地址的配置这里就不多言啦/// 可以上网的话基本都已经配置好啦，可使用hostname查询主机名</p>
<p>三、主配置文件named.conf的配置<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;因为主配置文件named.conf包含一句话扩展外包配置文件的记录：include “/etc/named.rfc1912.zones”;故这里在配置定义正向解析文件与反向解析文件</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>yanqx ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;">#vim /var/named/chroot/etc/named.rfc1912.zonesf</span>
zone <span style="color: #ff0000;">&quot;yousri.com&quot;</span> IN <span style="color: #7a0874; font-weight: bold;">&#123;</span>       <span style="color: #000000; font-weight: bold;">//</span>定义一个正向域yousri.com
<span style="color: #7a0874; font-weight: bold;">type</span> master;
<span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #ff0000;">&quot;yousri.com.db&quot;</span>;    <span style="color: #000000; font-weight: bold;">//</span>定义正向解析文件名 yousri.com.db
allow-update <span style="color: #7a0874; font-weight: bold;">&#123;</span> none; <span style="color: #7a0874; font-weight: bold;">&#125;</span>;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>;
zone <span style="color: #ff0000;">&quot;1.168.192.in-addr.arpa&quot;</span> IN <span style="color: #7a0874; font-weight: bold;">&#123;</span>        <span style="color: #000000; font-weight: bold;">//</span>定义反向域
<span style="color: #7a0874; font-weight: bold;">type</span> master;
<span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #ff0000;">&quot;1.168.192.db&quot;</span>;                  <span style="color: #000000; font-weight: bold;">//</span>定义反向解析文件名 1.168.192.db
allow-update <span style="color: #7a0874; font-weight: bold;">&#123;</span> none; <span style="color: #7a0874; font-weight: bold;">&#125;</span>;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>;</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;添加以上两段配置文件保存并退出</p>
<p>四、配置正向解析与反向解析文件<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;正向反向解析文件都创建在相同目录—/var/named/chroot/var/named/下，且可直接使用原有的模板localdomain.zone及named.local分别修改而得</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>yanqx ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;">#cd /var/named/chroot/var/named</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>yanqx named<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;">#cp -p localdomain.zone yousri.com.db</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>yanqx named<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;">#cp -p named.local 1.168.192.db</span></pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使用参数p，是为了复制文件时保持文件的属性不变，防止有误导致稍后named服务无法启动/// 接下来分别修改这两个配置文件为如下：<br />
正向解析文件：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>yanqx named<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;">#vim yousri.com.db</span>
 <span style="color: #007800;">$TTL</span> <span style="color: #000000;">86400</span>
 <span style="color: #007800;">$ORIGIN</span> yousri.com.
 <span style="color: #000000; font-weight: bold;">@</span>         IN SOA yanqx.yousri.com. root.yanqx.yousri.com. <span style="color: #7a0874; font-weight: bold;">&#40;</span>
                <span style="color: #000000;">20060415</span>              ; serial <span style="color: #7a0874; font-weight: bold;">&#40;</span>d. adams<span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000;">28800</span>       ; refresh
             <span style="color: #000000;">7200</span>   ; retry
           <span style="color: #000000;">604800</span>   ; expiry
            <span style="color: #000000;">86400</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>   ; minimum
&nbsp;
         IN NS   yanqx.yousri.com.
         IN MX <span style="color: #000000;">10</span> mail.yousri.com.
 <span style="color: #000000; font-weight: bold;">@</span>   IN A 192.168.1.99
 yanqx IN A 192.168.1.99
 mail IN A 192.168.1.99
 www IN CNAME yanqx</pre></div></div>

<p>反向解析文件：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>yanqx named<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;">#vim 1.168.192.db</span>
 <span style="color: #007800;">$TTL</span> <span style="color: #000000;">86400</span>
 <span style="color: #000000; font-weight: bold;">@</span>         IN SOA yanqx.yousri.com. root.yanqx.yousri.com. <span style="color: #7a0874; font-weight: bold;">&#40;</span>
                                     <span style="color: #000000;">20060415</span>              ; serial <span style="color: #7a0874; font-weight: bold;">&#40;</span>d. adams<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                                        <span style="color: #000000;">28800</span>              ; refresh
                                         <span style="color: #000000;">7200</span>              ; retry
                                       <span style="color: #000000;">604800</span>              ; expiry
                                        <span style="color: #000000;">86400</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>            ; minimum
&nbsp;
         IN NS yousri.com.
 <span style="color: #000000;">99</span>      IN PTR yanqx.yousri.com.
 <span style="color: #000000;">99</span>      IN PTR mail.yousri.com.</pre></div></div>

</p>
<p>五、系统配置<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1、修改/etc/resolv.conf文件，添加一条本机IP的DNS记录，以便实现域名解析效果</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>yanqx named<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;">#vim /etc/resolv.conf</span>
 nameserver 202.101.103.54
 nameserver 202.101.103.55
 nameserver 192.168.1.99</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;其中202.101.103.54&amp;202.101.103.55为厦门电信DNS，120.35.120.155为本机IP地址<br />
2、启动DNS服务及named服务</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>yanqx ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;">#/etc/init.d/named start</span></pre></div></div>

<p>或者</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>yanqx ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;">#service named start</span></pre></div></div>

<p>3、测试服务<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使用测试的命令是dig或nslookup或ping 侦测验证或更具体的客户端验证<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;windows xp/2003客户端配置：网上邻居–属性–网络连接–属性–TCP/IP/属性/DNS–添加192.168.1.99记录保存退出即可。接着还可以结合已配置有DNS服务的服务器上搭建apache服务，配置apache基于名字的虚拟主机服务，配置使用www.yousri.com的域名，并在客户端（刚已设置好DNS的客户端上）直接浏览器浏览http://www.yousri.com访问apache服务的虚拟主机程序。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yousri.org/2009/02/21/centos52%e6%90%ad%e5%bb%ba%e9%85%8d%e7%bd%aedns%e6%9c%8d%e5%8a%a1.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>实现Windows定时关机脚本</title>
		<link>http://blog.yousri.org/2009/02/17/%e5%ae%9e%e7%8e%b0windows%e5%ae%9a%e6%97%b6%e5%85%b3%e6%9c%ba%e8%84%9a%e6%9c%ac.html</link>
		<comments>http://blog.yousri.org/2009/02/17/%e5%ae%9e%e7%8e%b0windows%e5%ae%9a%e6%97%b6%e5%85%b3%e6%9c%ba%e8%84%9a%e6%9c%ac.html#comments</comments>
		<pubDate>Tue, 17 Feb 2009 09:41:28 +0000</pubDate>
		<dc:creator>Yousri</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[脚本编程]]></category>
		<category><![CDATA[定时关机]]></category>
		<category><![CDATA[脚本]]></category>

		<guid isPermaLink="false">http://qingxianyan.cn/?p=277</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160; 刚刚一个朋友发来QQ消息问我用过可以设置自动关机的播放器么///额，自己倒是还没用过，原来她是想开着机子放音乐伴随着歌声入睡然后自动关机，自己只 在linux下使用命令设置定时关机，在windows下倒是貌似比较少用过这类附带有这类功能的软件便是，最多也就用一些批处理.bat脚本来定制实现 的吧。。。。后来就也只能用这个分享给她用啦///呵呵，其实也挺简单方便的，所以这里贴出来共享下（谁写忘记，因为当初也是朋友分享于我） &#160;&#160;&#160;&#160; 实现的主要功能包括：定时关机、倒计时关机、删除定时关机任务、查看任务状态、重启、注销、锁定计算机等 @ECHO off TITLE greaterthanme-实现定时关机、注销、重启、锁定等功能。 &#160; :start CLS COLOR 1f rem 使用COLOR命令对控制台输出颜色进行更改 MODE con: COLS=41 LINES=18 rem MODE语句为设定窗体的宽和高 set tm1=%time:~0,2% set tm2=%time:~3,2% set tm3=%time:~6,2% ECHO %date% %tm1%点%tm2%分%tm3%秒 ECHO ========================================= ECHO 请选择要进行的操作，然后按回车 ECHO ─────────────── ECHO. ECHO 1. 定时关机 ECHO 2. 倒计时关机 ECHO 3. 删除定时关机任务 ECHO 4. 查看任务状态 ECHO 5. 刷新当前时间 ECHO [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
刚刚一个朋友发来QQ消息问我用过可以设置自动关机的播放器么///额，自己倒是还没用过，原来她是想开着机子放音乐伴随着歌声入睡然后自动关机，自己只<br />
在linux下使用命令设置定时关机，在windows下倒是貌似比较少用过这类附带有这类功能的软件便是，最多也就用一些批处理.bat脚本来定制实现<br />
的吧。。。。后来就也只能用这个分享给她用啦///呵呵，其实也挺简单方便的，所以这里贴出来共享下（谁写忘记，因为当初也是朋友分享于我）</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; 实现的主要功能包括：定时关机、倒计时关机、删除定时关机任务、查看任务状态、重启、注销、锁定计算机等</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;"><span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">ECHO</span> off
<span style="color: #b1b100; font-weight: bold;">TITLE</span> greaterthanme-实现定时关机、注销、重启、锁定等功能。
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">start</span>
CLS
COLOR 1f
<span style="color: #808080; font-style: italic;">rem 使用COLOR命令对控制台输出颜色进行更改</span>
MODE <span style="color: #0000ff; font-weight: bold;">con</span>: COLS=<span style="color: #cc66cc;">41</span> LINES=<span style="color: #cc66cc;">18</span>
<span style="color: #808080; font-style: italic;">rem MODE语句为设定窗体的宽和高</span>
<span style="color: #b1b100; font-weight: bold;">set</span> <span style="color: #448844;">tm1</span>=<span style="color: #33cc33;">%</span><span style="color: #448888;">time:~<span style="color: #cc66cc;">0</span>,2</span><span style="color: #33cc33;">%</span>
<span style="color: #b1b100; font-weight: bold;">set</span> <span style="color: #448844;">tm2</span>=<span style="color: #33cc33;">%</span><span style="color: #448888;">time:~<span style="color: #cc66cc;">3</span>,2</span><span style="color: #33cc33;">%</span>
<span style="color: #b1b100; font-weight: bold;">set</span> <span style="color: #448844;">tm3</span>=<span style="color: #33cc33;">%</span><span style="color: #448888;">time:~<span style="color: #cc66cc;">6</span>,2</span><span style="color: #33cc33;">%</span>
<span style="color: #b1b100; font-weight: bold;">ECHO</span> <span style="color: #33cc33;">%</span><span style="color: #448888;">date</span><span style="color: #33cc33;">%</span> <span style="color: #33cc33;">%</span><span style="color: #448888;">tm1</span><span style="color: #33cc33;">%</span>点<span style="color: #33cc33;">%</span><span style="color: #448888;">tm2</span><span style="color: #33cc33;">%</span>分<span style="color: #33cc33;">%</span><span style="color: #448888;">tm3</span><span style="color: #33cc33;">%</span>秒
<span style="color: #b1b100; font-weight: bold;">ECHO</span> =========================================
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 请选择要进行的操作，然后按回车
<span style="color: #b1b100; font-weight: bold;">ECHO</span> ───────────────
<span style="color: #b1b100; font-weight: bold;">ECHO</span>.
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 1. 定时关机
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 2. 倒计时关机
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 3. 删除定时关机任务
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 4. 查看任务状态
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 5. 刷新当前时间
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 6. 重新启动
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 7. 锁定计算机
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 8. 注销
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 9. 退出
<span style="color: #b1b100; font-weight: bold;">ECHO</span>.
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">cho</span>
<span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">Choice</span>=
<span style="color: #b1b100; font-weight: bold;">SET</span> /P <span style="color: #448844;">Choice</span>=选择:
<span style="color: #808080; font-style: italic;">rem 设定变量&quot;Choice&quot;为用户输入的字符</span>
<span style="color: #00b100; font-weight: bold;">IF</span> <span style="color: #000000; font-weight: bold;">NOT</span> &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">Choice</span><span style="color: #33cc33;">%</span>&quot;==&quot;&quot; <span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">Choice</span>=<span style="color: #33cc33;">%</span><span style="color: #448888;">Choice:~<span style="color: #cc66cc;">0</span>,1</span><span style="color: #33cc33;">%</span>
<span style="color: #808080; font-style: italic;">rem 如果输入大于1位,取第1位,比如输入132,则返回值为1</span>
<span style="color: #b1b100; font-weight: bold;">ECHO</span>.
<span style="color: #00b100; font-weight: bold;">IF</span> /I &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">Choice</span><span style="color: #33cc33;">%</span>&quot;==&quot;<span style="color: #cc66cc;">1</span>&quot; <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">SetHour</span>
<span style="color: #00b100; font-weight: bold;">IF</span> /I &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">Choice</span><span style="color: #33cc33;">%</span>&quot;==&quot;<span style="color: #cc66cc;">2</span>&quot; <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">outtime</span>
<span style="color: #00b100; font-weight: bold;">IF</span> /I &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">Choice</span><span style="color: #33cc33;">%</span>&quot;==&quot;<span style="color: #cc66cc;">3</span>&quot; <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">delAt</span>
<span style="color: #00b100; font-weight: bold;">IF</span> /I &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">Choice</span><span style="color: #33cc33;">%</span>&quot;==&quot;<span style="color: #cc66cc;">4</span>&quot; <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">view</span>
<span style="color: #00b100; font-weight: bold;">IF</span> /I &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">Choice</span><span style="color: #33cc33;">%</span>&quot;==&quot;<span style="color: #cc66cc;">5</span>&quot; <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">start</span>
<span style="color: #00b100; font-weight: bold;">IF</span> /I &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">Choice</span><span style="color: #33cc33;">%</span>&quot;==&quot;<span style="color: #cc66cc;">6</span>&quot; <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">restart</span>
<span style="color: #00b100; font-weight: bold;">IF</span> /I &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">Choice</span><span style="color: #33cc33;">%</span>&quot;==&quot;<span style="color: #cc66cc;">7</span>&quot; <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">lock</span>
<span style="color: #00b100; font-weight: bold;">IF</span> /I &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">Choice</span><span style="color: #33cc33;">%</span>&quot;==&quot;<span style="color: #cc66cc;">8</span>&quot; <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">logoff</span>
<span style="color: #00b100; font-weight: bold;">IF</span> /I &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">Choice</span><span style="color: #33cc33;">%</span>&quot;==&quot;<span style="color: #cc66cc;">9</span>&quot; <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">end</span>
<span style="color: #808080; font-style: italic;">rem 为避免出现返回值为空或含空格而导致程序异常,需在变量外另加双引号</span>
<span style="color: #808080; font-style: italic;">rem 注意,IF语句需要双等于号</span>
<span style="color: #808080; font-style: italic;">rem 如果输入的字符不是以上数字,将返回重新输入</span>
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 选择无效，请重新输入
<span style="color: #b1b100; font-weight: bold;">ECHO</span>.
<span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">cho</span>
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">SetHour</span>
CLS
<span style="color: #b1b100; font-weight: bold;">ECHO</span>.
<span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">ask</span>=
<span style="color: #b1b100; font-weight: bold;">SET</span> /p <span style="color: #448844;">ask</span>=是否设定为每天执行关机命令<span style="color: #66cc66;">&#40;</span>y/n<span style="color: #66cc66;">&#41;</span>:
<span style="color: #00b100; font-weight: bold;">IF</span> <span style="color: #000000; font-weight: bold;">NOT</span> &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">ask</span><span style="color: #33cc33;">%</span>&quot;==&quot;&quot; <span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">ask</span>=<span style="color: #33cc33;">%</span><span style="color: #448888;">ask:~<span style="color: #cc66cc;">0</span>,1</span><span style="color: #33cc33;">%</span>
<span style="color: #00b100; font-weight: bold;">IF</span> /I &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">ask</span><span style="color: #33cc33;">%</span>&quot;==&quot;y&quot; <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">yes</span>
<span style="color: #00b100; font-weight: bold;">IF</span> /I &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">ask</span><span style="color: #33cc33;">%</span>&quot;==&quot;n&quot; <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">no</span>
<span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">SetHour</span>
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">yes</span>
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 请指定<span style="color: #cc66cc;">24</span>小时制式时间,格式为 小时:分钟
<span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">shutdowntime</span>=
<span style="color: #b1b100; font-weight: bold;">SET</span> /p <span style="color: #448844;">shutdowntime</span>=输入:
at <span style="color: #33cc33;">%</span><span style="color: #448888;">shutdowntime</span><span style="color: #33cc33;">%</span> /every:M,T,W,Th,F,S,Su tsshutdn <span style="color: #cc66cc;">0</span> /delay:<span style="color: #cc66cc;">0</span> /powerdown &amp;gt;<span style="color: #0000ff; font-weight: bold;">nul</span>
<span style="color: #808080; font-style: italic;">rem 设定为每周的星期一至星期日,即为每天</span>
<span style="color: #00b100; font-weight: bold;">IF</span> <span style="color: #000000; font-weight: bold;">NOT</span> <span style="color: #000000; font-weight: bold;">errorlevel</span> <span style="color: #cc66cc;">1</span> <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">ok</span>
<span style="color: #808080; font-style: italic;">rem 如果输入正确,就执行ok段的语句</span>
<span style="color: #b1b100; font-weight: bold;">ECHO</span> <span style="color: #33cc33;">%</span><span style="color: #448888;">shutdowntime</span><span style="color: #33cc33;">%</span> 不是标准的时间格式,请重新输入
<span style="color: #b1b100; font-weight: bold;">ECHO</span>.
<span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">yes</span>
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">no</span>
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 请指定<span style="color: #cc66cc;">24</span>小时制式时间,格式为 小时:分钟
<span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">shutdowntime</span>=
<span style="color: #b1b100; font-weight: bold;">SET</span> /p <span style="color: #448844;">shutdowntime</span>=输入:
at <span style="color: #33cc33;">%</span><span style="color: #448888;">shutdowntime</span><span style="color: #33cc33;">%</span> tsshutdn <span style="color: #cc66cc;">0</span> /delay:<span style="color: #cc66cc;">0</span> /powerdown &amp;gt;<span style="color: #0000ff; font-weight: bold;">nul</span>
<span style="color: #00b100; font-weight: bold;">IF</span> <span style="color: #000000; font-weight: bold;">NOT</span> <span style="color: #000000; font-weight: bold;">errorlevel</span> <span style="color: #cc66cc;">1</span> <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">ok</span>
<span style="color: #b1b100; font-weight: bold;">ECHO</span> <span style="color: #33cc33;">%</span><span style="color: #448888;">shutdowntime</span><span style="color: #33cc33;">%</span> 不是标准的时间格式,请重新输入
<span style="color: #b1b100; font-weight: bold;">ECHO</span>.
<span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">no</span>
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">ok</span>
<span style="color: #b1b100; font-weight: bold;">ECHO</span>.
<span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">h</span>=<span style="color: #33cc33;">%</span><span style="color: #448888;">shutdowntime:~<span style="color: #cc66cc;">1</span>,1</span><span style="color: #33cc33;">%</span>
<span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">ah</span>=<span style="color: #33cc33;">%</span><span style="color: #448888;">shutdowntime:~<span style="color: #cc66cc;">0</span>,1</span><span style="color: #33cc33;">%</span>
<span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">am</span>=<span style="color: #33cc33;">%</span><span style="color: #448888;">shutdowntime:~<span style="color: #cc66cc;">2</span>,2</span><span style="color: #33cc33;">%</span>
<span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">bh</span>=<span style="color: #33cc33;">%</span><span style="color: #448888;">shutdowntime:~<span style="color: #cc66cc;">0</span>,2</span><span style="color: #33cc33;">%</span>
<span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">bm</span>=<span style="color: #33cc33;">%</span><span style="color: #448888;">shutdowntime:~<span style="color: #cc66cc;">3</span>,2</span><span style="color: #33cc33;">%</span>
<span style="color: #00b100; font-weight: bold;">IF</span> &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">h</span><span style="color: #33cc33;">%</span>&quot;==&quot;:&quot; <span style="color: #66cc66;">&#40;</span>
<span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">HM</span>=<span style="color: #33cc33;">%</span><span style="color: #448888;">ah</span><span style="color: #33cc33;">%</span>时<span style="color: #33cc33;">%</span><span style="color: #448888;">am</span><span style="color: #33cc33;">%</span>分
<span style="color: #66cc66;">&#41;</span> <span style="color: #00b100; font-weight: bold;">ELSE</span> <span style="color: #66cc66;">&#40;</span>
<span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">HM</span>=<span style="color: #33cc33;">%</span><span style="color: #448888;">bh</span><span style="color: #33cc33;">%</span>时<span style="color: #33cc33;">%</span><span style="color: #448888;">bm</span><span style="color: #33cc33;">%</span>分<span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">rem 如果输入h:mm则HM=h时mm分,否则HM=hh时mm分</span>
<span style="color: #00b100; font-weight: bold;">IF</span> /I &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">ask</span><span style="color: #33cc33;">%</span>&quot;==&quot;y&quot; <span style="color: #b1b100; font-weight: bold;">ECHO</span> 系统将于每天的<span style="color: #33cc33;">%</span><span style="color: #448888;">HM</span><span style="color: #33cc33;">%</span>关闭
<span style="color: #00b100; font-weight: bold;">IF</span> /I &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">ask</span><span style="color: #33cc33;">%</span>&quot;==&quot;n&quot; <span style="color: #b1b100; font-weight: bold;">ECHO</span> 系统将于<span style="color: #33cc33;">%</span><span style="color: #448888;">HM</span><span style="color: #33cc33;">%</span>关闭
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 设定完毕! 按任意键继续...
<span style="color: #b1b100; font-weight: bold;">PAUSE</span> &amp;gt;<span style="color: #0000ff; font-weight: bold;">nul</span>
<span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">start</span>
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">outtime</span>
CLS
<span style="color: #b1b100; font-weight: bold;">ECHO</span>.
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 请输入倒计时秒数
<span style="color: #b1b100; font-weight: bold;">ECHO</span> ────────
<span style="color: #b1b100; font-weight: bold;">ECHO</span> <span style="color: #66cc66;">&#40;</span>设定后要取消,单击&quot;确定&quot;后按Ctrl+C键两次<span style="color: #66cc66;">&#41;</span>
<span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">timed</span>=
<span style="color: #b1b100; font-weight: bold;">SET</span> /p <span style="color: #448844;">timed</span>=输入:
tsshutdn <span style="color: #33cc33;">%</span><span style="color: #448888;">timed</span><span style="color: #33cc33;">%</span> /delay:<span style="color: #cc66cc;">0</span> /powerdown &amp;gt;<span style="color: #0000ff; font-weight: bold;">nul</span>
<span style="color: #00b100; font-weight: bold;">IF</span> <span style="color: #000000; font-weight: bold;">not</span> <span style="color: #000000; font-weight: bold;">errorlevel</span> <span style="color: #cc66cc;">1</span> <span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">ok</span>
<span style="color: #b1b100; font-weight: bold;">ECHO</span> <span style="color: #33cc33;">%</span><span style="color: #448888;">timed</span><span style="color: #33cc33;">%</span> 是无效的关机时间,请重新输入
<span style="color: #b1b100; font-weight: bold;">ECHO</span>.
<span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">outtime</span>
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">delAt</span>
cls
<span style="color: #b1b100; font-weight: bold;">echo</span>.
at /<span style="color: #b1b100; font-weight: bold;">del</span> /y
<span style="color: #b1b100; font-weight: bold;">echo</span> 定时关机任务已取消,按任意键继续...
<span style="color: #b1b100; font-weight: bold;">pause</span> &amp;gt;<span style="color: #0000ff; font-weight: bold;">nul</span>
<span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">start</span>
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">view</span>
MODE <span style="color: #0000ff; font-weight: bold;">con</span>: COLS=<span style="color: #cc66cc;">85</span> LINES=<span style="color: #cc66cc;">18</span>
COLOR <span style="color: #cc66cc;">70</span>
<span style="color: #b1b100; font-weight: bold;">ECHO</span>.
at
<span style="color: #b1b100; font-weight: bold;">ECHO</span> 按任意键继续...
<span style="color: #b1b100; font-weight: bold;">PAUSE</span> &amp;gt;<span style="color: #0000ff; font-weight: bold;">nul</span>
<span style="color: #00b100; font-weight: bold;">GOTO</span> <span style="color: #b100b1; font-weight: bold;">start</span>
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">restart</span>
shutdown -r -t <span style="color: #cc66cc;">0</span>
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">lock</span>
rundll32.exe user32.dll,LockWorkStation
<span style="color: #00b100; font-weight: bold;">goto</span> <span style="color: #b100b1; font-weight: bold;">start</span>
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">logoff</span>
logoff
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">end</span>
<span style="color: #00b100; font-weight: bold;">exit</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.yousri.org/2009/02/17/%e5%ae%9e%e7%8e%b0windows%e5%ae%9a%e6%97%b6%e5%85%b3%e6%9c%ba%e8%84%9a%e6%9c%ac.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nagios基本平台搭建</title>
		<link>http://blog.yousri.org/2009/02/11/nagios%e5%9f%ba%e6%9c%ac%e5%b9%b3%e5%8f%b0%e6%90%ad%e5%bb%ba.html</link>
		<comments>http://blog.yousri.org/2009/02/11/nagios%e5%9f%ba%e6%9c%ac%e5%b9%b3%e5%8f%b0%e6%90%ad%e5%bb%ba.html#comments</comments>
		<pubDate>Wed, 11 Feb 2009 08:23:29 +0000</pubDate>
		<dc:creator>Yousri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[网络管理]]></category>
		<category><![CDATA[nagios]]></category>

		<guid isPermaLink="false">http://qingxianyan.cn/?p=270</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160; Nagios的功能是监控服务和主机，但是他自身并不包括这部分功能的代码，所有的监控、检测功能都是有插件来完成的。再说报警功能，如果监控系统发现问题不能报警那就没有意义了，所以报警也是Nagios很重要的功能之一。但是，同样的，nagios自身也没有报警部分的代码，甚至没有插件，而是交给用户或者其他相关开源项目组去完成。类似这样细致的工作，被Nagios的开发人员称为dirty work（脏活）。其实脏活不脏，只是太细致了，对于nagios&#8212;&#8212;一个负责监控工作的老板来说，细致的工作必然是交给他的员工去搞定啦。 &#160;&#160;&#160;&#160;&#160; 这里只小分享下关于Nagios安装，只是指基本平台，也就是Nagios软件包的安装。它是监控体系的框架，也是所有监控的基础。后续系列文章会再更多的分享 &#160;&#160;&#160;&#160;&#160;在Nagios官方的文档，会发现Nagios基本上没有什么依赖包，只要求系统是linux或者其他nagios支持的系统。不过如果你没有安装Apache（http web服务），那么就没办法直观的界面来了解信息，所以apache可以算是一个前提条件。关于apache的安装，网上相关文档多得是，找Google老师~ &#160;&#160;&#160;&#160;&#160; 官方网站下载最新的nagios软件包，这里使用的是nagios-3.0.4.tar.gz版本下实现的 。建议先阅读官方文档相关帮助信息。 &#160;&#160;&#160;&#160;&#160; 1、 创建Nagios用户 adduser nagios mkdir /usr/local/nagios chown nagios.nagios /usr/local/nagios &#160;&#160;&#160;&#160; 2、 建立Nagios组 grep &#34;^User&#34; /etc/httpd/conf/httpd.conf /usr/sbin/usermod -G nagcmd apache #apache的用户名 /usr/sbin/usermod -G nagcmd nagios &#160;&#160;&#160;&#160; 3、 解压 tar xzf nagios-3.0.4.tar.gz &#160;&#160;&#160;&#160; 4、 编译 ./configure --prefix=prefix --with-nagios-user=someuser \\ --with-nagios-group=somegroup --with-command-group=cmdgroup #变量prefix 为安装目录，例如/usr/local/nagios #变量someuser 为nagios的用户，例如nagios #变量somegruop [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Nagios的功能是监控服务和主机，但是他自身并不包括这部分功能的代码，所有的监控、检测功能都是有插件来完成的。再说报警功能，如果监控系统发现问题不能报警那就没有意义了，所以报警也是Nagios很重要的功能之一。但是，同样的，nagios自身也没有报警部分的代码，甚至没有插件，而是交给用户或者其他相关开源项目组去完成。类似这样细致的工作，被Nagios的开发人员称为dirty work（脏活）。其实脏活不脏，只是太细致了，对于nagios&mdash;&mdash;一个负责监控工作的老板来说，细致的工作必然是交给他的员工去搞定啦。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这里只小分享下关于Nagios安装，只是指基本平台，也就是Nagios软件包的安装。它是监控体系的框架，也是所有监控的基础。后续系列文章会再更多的分享</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在Nagios官方的文档，会发现Nagios基本上没有什么依赖包，只要求系统是linux或者其他nagios支持的系统。不过如果你没有安装Apache（http web服务），那么就没办法直观的界面来了解信息，所以apache可以算是一个前提条件。关于apache的安装，网上相关文档多得是，找Google老师~</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a title="http://www.nagios.org/download/" rel="nofollow" href="http://www.nagios.org/download/" target="_blank">官方网站下载</a>最新的nagios软件包，这里使用的是nagios-3.0.4.tar.gz版本下实现的 。建议先阅读官方文档相关帮助信息。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1、 创建Nagios用户</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">adduser nagios
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>nagios
<span style="color: #c20cb9; font-weight: bold;">chown</span> nagios.nagios <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>nagios</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp; 2、 建立Nagios组</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;^User&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>httpd.conf
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>usermod <span style="color: #660033;">-G</span> nagcmd apache <span style="color: #666666; font-style: italic;">#apache的用户名</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>usermod <span style="color: #660033;">-G</span> nagcmd nagios</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp; 3、 解压</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xzf nagios-3.0.4.tar.gz</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp; 4、 编译</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=prefix <span style="color: #660033;">--with-nagios-user</span>=someuser  \\
<span style="color: #660033;">--with-nagios-group</span>=somegroup <span style="color: #660033;">--with-command-group</span>=cmdgroup
<span style="color: #666666; font-style: italic;">#变量prefix 为安装目录，例如/usr/local/nagios</span>
<span style="color: #666666; font-style: italic;">#变量someuser 为nagios的用户，例如nagios</span>
<span style="color: #666666; font-style: italic;">#变量somegruop 为nagios属于的组，例如nagios</span>
<span style="color: #666666; font-style: italic;">#变量cmdgroup 为nagios命令行属组，例如nagcmd</span></pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;5、 安装</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span> all
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> install-config
<span style="color: #c20cb9; font-weight: bold;">make</span> install-init</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp; 6、 检查</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>nagios<span style="color: #000000; font-weight: bold;">/</span>
bin  etc  libexec  sbin  share  var
bin  etc  sbin  share  var
<span style="color: #666666; font-style: italic;">#看到这5个目录就ok了</span></pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;7、 生成http用户验证文件，用户名为Nagios</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>htpasswd <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>nagios<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>htpasswd.users nagios</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;8、 将Nagios的信息加到apache中，打开/etc/apache2/apache2.conf文件，在文件最后添加如下代码：</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">ScriptAlias</span> /nagios/cgi-bin /usr/local/nagios/sbin
&nbsp;
<span style="color: #00007f;">Options</span> ExecCGI
<span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">None</span>
<span style="color: #00007f;">Order</span> <span style="color: #00007f;">allow</span>,<span style="color: #00007f;">deny</span>
<span style="color: #00007f;">Allow</span> <span style="color: #00007f;">from</span> <span style="color: #00007f;">all</span>
<span style="color: #00007f;">AuthName</span> <span style="color: #7f007f;">&quot;Nagios Access&quot;</span>
<span style="color: #00007f;">AuthType</span> Basic
<span style="color: #00007f;">AuthUserFile</span> /usr/local/nagios/etc/htpasswd.users
<span style="color: #00007f;">Require</span> valid-<span style="color: #00007f;">user</span>
&nbsp;
<span style="color: #00007f;">Alias</span> /nagios /usr/local/nagios/share
&nbsp;
<span style="color: #00007f;">Options</span> <span style="color: #0000ff;">None</span>
<span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">None</span>
<span style="color: #00007f;">Order</span> <span style="color: #00007f;">allow</span>,<span style="color: #00007f;">deny</span>
<span style="color: #00007f;">Allow</span> <span style="color: #00007f;">from</span> <span style="color: #00007f;">all</span>
<span style="color: #00007f;">AuthName</span> <span style="color: #7f007f;">&quot;Nagios Access&quot;</span>
<span style="color: #00007f;">AuthType</span> Basic
<span style="color: #00007f;">AuthUserFile</span> /usr/local/nagios/etc/htpasswd.users
<span style="color: #00007f;">Require</span> valid-<span style="color: #00007f;">user</span>
;</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 9、 重启apache服务</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10、 测试Nagios基本平台实现：http://localhost/nagios/</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yousri.org/2009/02/11/nagios%e5%9f%ba%e6%9c%ac%e5%b9%b3%e5%8f%b0%e6%90%ad%e5%bb%ba.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nagios插件安装</title>
		<link>http://blog.yousri.org/2009/02/09/install-nagios-plugins.html</link>
		<comments>http://blog.yousri.org/2009/02/09/install-nagios-plugins.html#comments</comments>
		<pubDate>Mon, 09 Feb 2009 10:02:59 +0000</pubDate>
		<dc:creator>Yousri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[网络管理]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[监控]]></category>

		<guid isPermaLink="false">http://qingxianyan.cn/?p=292</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160; 刚刚在Nagios基本平台搭建一文中也提到，对于Nagios的监测主机与服务功能其实是有其附带的插件来实现的，而Nagios系统本身只是一个空壳而已.因此，在安装了nagios平台之后的第一件事情就是将插件安装上去。这里使用的是插件源码包是从Nagios主页上下载了最新的官方插件，用的版本是nagios-plugins-1.4.13.tar.gz。 1、解压 tar zxvf nagios-plugins-1.4.13.tar.gzcd nagios-plugins-1.4.13&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2、编译安装： ./configure --prefix=/usr/local/nagios &#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#8211;with-cgiurl=/usr/local/nagios/cgi-bin &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211;enable-ssl &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211;enable-command-args&#160;&#160;&#160; make&#160;&#160;&#160; make install 3、相关配置文件：&#160;&#160;&#160;&#160;&#160;&#160;&#160; ## 根据具体使用情况,将配置文件的结构做以下规划,为了方便将来的维护和管理: &#160;&#160;&#160;&#160;&#160;&#160;&#160; ## 配置文件结构如下:&#160;&#160;&#160;&#160;&#160;&#160;&#160; etc/&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;&#8211; cgi.cfg&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;&#8211; commands.cfg&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;&#8211; nagios.cfg&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;&#8211; resource.cfg&#160;&#160;&#160;&#160;&#160;&#160;&#160; (以上为nagios系统主配置文件) &#160;&#160;&#160;&#160;&#160;&#160;&#160; etc/servers&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;&#8211; contacts.cfg&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 管理人员和管理人员组的的默认初始化设定文件&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;&#8211; hostgroups.cfg&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 服务器组的默认初始化设定文件&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;&#8211; hosts.cfg&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 服务器的默认初始化设定文件&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;&#8211; services.cfg&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 监控服务的默认初始化设定文件&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;&#8211; servicegroups.cfg&#160;&#160;&#160;&#160;&#160;&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 刚刚在Nagios基本平台搭建一文中也提到，对于Nagios的监测主机与服务功能其实是有其附带的插件来实现的，而Nagios系统本身只是一个空壳而已.因此，在安装了nagios平台之后的第一件事情就是将插件安装上去。<span>这里使用的是插件源码包是从</span><span lang="EN-US">Nagios</span><span>主页上下载了最新的</span><span>官方插件，用的版本是</span><span lang="EN-US">nagios-plugins-1.4.13.tar.gz</span><span>。</span></p>
<p><span>1、解压</p>
<blockquote><p><code>tar zxvf nagios-plugins-1.4.13.tar.gz<br />cd nagios-plugins-1.4.13</code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p></blockquote>
<p></span></p>
<p>2、编译安装：</p>
<blockquote><p><code>./configure --prefix=/usr/local/nagios <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &ndash;with-cgiurl=/usr/local/nagios/cgi-bin <br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &ndash;enable-ssl <br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &ndash;enable-command-args<br />&nbsp;&nbsp;&nbsp; make<br />&nbsp;&nbsp;&nbsp; make install</code></p></blockquote>
<p><span>3、相关配置文件：<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ## 根据具体使用情况,将配置文件的结构做以下规划,为了方便将来的维护和管理:</span></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ## 配置文件结构如下:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; etc/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&ndash; cgi.cfg<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&ndash; commands.cfg<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&ndash; nagios.cfg<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&ndash; resource.cfg<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (以上为nagios系统主配置文件)</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; etc/servers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&ndash; contacts.cfg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 管理人员和管理人员组的的默认初始化设定文件<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&ndash; hostgroups.cfg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 服务器组的默认初始化设定文件<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&ndash; hosts.cfg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 服务器的默认初始化设定文件<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&ndash; services.cfg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 监控服务的默认初始化设定文件<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&ndash; servicegroups.cfg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 监控服务组的默认初始化设定文件<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&ndash; timeperiod.cfg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 时间周期默认初始化设定文件<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (以上为监控服务相关的配置文件,都是由原localhost.cfg文件中拆分出来的,这样方面理解和管理)</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; etc/servers/test.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&ndash; 172.17.0.220.cfg<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&ndash; 172.17.0.255.cfg<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (在etc/servers/下建立监控的域名目录,区分各个被监控的域名,每台监控的主机一个单独的配置文件,包含hosts和services的内容)</p>
<p>
<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 下班啦。。今日分享到此，待续ing。。。。。&nbsp;&nbsp; <br /></span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yousri.org/2009/02/09/install-nagios-plugins.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vi使用及ubuntu旧内核删除</title>
		<link>http://blog.yousri.org/2009/01/17/some-skills.html</link>
		<comments>http://blog.yousri.org/2009/01/17/some-skills.html#comments</comments>
		<pubDate>Sat, 17 Jan 2009 02:00:30 +0000</pubDate>
		<dc:creator>Yousri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[字符串替换]]></category>
		<category><![CDATA[旧内核卸载]]></category>

		<guid isPermaLink="false">http://xmlinuxers.cn/?p=230</guid>
		<description><![CDATA[一、vi编辑器操作实现字符串替换： &#160;&#160;&#160; vi 中如何使用 :s 命令实现字串的替换.&#160;&#160;&#160; :s/str1/str2/ 用字串 str2 替换行中首次出现的字串 str1 &#160;&#160;&#160; :s/str1/str2/g 用字串 str2 替换行中所有出现的字串 str1 &#160;&#160;&#160; :.,$ s/str1/str2/g 用字串str2替换正文当前行到末尾所有出现的字符串str1 &#160;&#160;&#160; :1,$ s/str1/str2/g 用字串str2替换正文中所有出现的字串str1 &#160;&#160;&#160; :g/str1/s//str2/g 用字串str2替换正文中所有出现的字串str1 &#160;&#160;&#160; :%s/str1/str2/g 用字串str2替换正文中所有出现的字串str1 &#160;&#160;&#160; 可见,g放在命令末尾,表示对搜索字串的每次出现进行替换;不加g,表示只对搜索字串的首次出现进行替换,g放在命令开头,表示对正文中所有包含搜索字串的行进行替换. &#160;&#160;&#160; 这是最近配置文件使用vi编辑器时遇到学习，所以在此备忘记录分享下 二、删除ubuntu旧内核操作： &#160;&#160;&#160; #dpkg -get selections&#124;grep linux&#160;&#160; //查询确认ubuntu现已有的不同版本内核&#160;&#160;&#160; #apt-get remove linux-images-2.26.27-7-generic&#160; //带有images的为内核版本号&#160;&#160;&#160; #uname -a&#160; // 确认现在系统所使用的是哪个版本&#160;&#160;&#160; #reboot&#160; //重启下电脑系统搞定 &#160;&#160;&#160; 因为太久没有使用乌班图系统，昨天晚上趁比较闲一点临睡前切换到ubuntu系统下先更新啦下。。。发现磁盘空间消耗有点多，想想自己之前貌似都没有删除下旧的内核得以腾点空间（虽然不多 呵呵） [...]]]></description>
			<content:encoded><![CDATA[<p>一、vi编辑器操作实现字符串替换：</p>
<p>&nbsp;&nbsp;&nbsp; vi 中如何使用 :s 命令实现字串的替换.<br />&nbsp;&nbsp;&nbsp; :s/str1/str2/ 用字串 str2 替换行中首次出现的字串 str1 <br />&nbsp;&nbsp;&nbsp; :s/str1/str2/g 用字串 str2 替换行中所有出现的字串 str1 <br />&nbsp;&nbsp;&nbsp; :.,$ s/str1/str2/g 用字串str2替换正文当前行到末尾所有出现的字符串str1 <br />&nbsp;&nbsp;&nbsp; :1,$ s/str1/str2/g 用字串str2替换正文中所有出现的字串str1 <br />&nbsp;&nbsp;&nbsp; :g/str1/s//str2/g 用字串str2替换正文中所有出现的字串str1 <br />&nbsp;&nbsp;&nbsp; :%s/str1/str2/g 用字串str2替换正文中所有出现的字串str1  </p>
<p>&nbsp;&nbsp;&nbsp; 可见,g放在命令末尾,表示对搜索字串的每次出现进行替换;不加g,表示只对搜索字串的首次出现进行替换,g放在命令开头,表示对正文中所有包含搜索字串的行进行替换. <br />&nbsp;&nbsp;&nbsp; 这是最近配置文件使用vi编辑器时遇到学习，所以在此备忘记录分享下</p>
<p>二、删除ubuntu旧内核操作：</p>
<p>&nbsp;&nbsp;&nbsp; #dpkg -get selections|grep linux&nbsp;&nbsp; //查询确认ubuntu现已有的不同版本内核<br />&nbsp;&nbsp;&nbsp; #apt-get remove linux-images-2.26.27-7-generic&nbsp; //带有images的为内核版本号<br />&nbsp;&nbsp;&nbsp; #uname -a&nbsp; // 确认现在系统所使用的是哪个版本<br />&nbsp;&nbsp;&nbsp; #reboot&nbsp; //重启下电脑系统搞定</p>
<p>&nbsp;&nbsp;&nbsp; 因为太久没有使用乌班图系统，昨天晚上趁比较闲一点临睡前切换到ubuntu系统下先更新啦下。。。发现磁盘空间消耗有点多，想想自己之前貌似都没有删除下旧的内核得以腾点空间（虽然不多 呵呵） 所以使用以上简要命令对乌班图的其他两三个旧内核卸载清空掉了。。。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yousri.org/2009/01/17/some-skills.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Server 2003服务器简易安全配置</title>
		<link>http://blog.yousri.org/2008/12/22/windows-server-2003-install-and-setting.html</link>
		<comments>http://blog.yousri.org/2008/12/22/windows-server-2003-install-and-setting.html#comments</comments>
		<pubDate>Sun, 21 Dec 2008 22:16:14 +0000</pubDate>
		<dc:creator>Yousri</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[服务配置]]></category>
		<category><![CDATA[IIS6]]></category>
		<category><![CDATA[PHP5]]></category>
		<category><![CDATA[windows server 2003]]></category>
		<category><![CDATA[安全]]></category>
		<category><![CDATA[配置]]></category>

		<guid isPermaLink="false">http://xmlinuxers.cn/?p=212</guid>
		<description><![CDATA[&#160;&#160;&#160; 这两天接触微软的windows server 2003搭建web服务器，实在是一个头两个大，对于安全防范及配置方面可谓是从未琢磨过，一次次的尝试一次次的验证修改，感觉其实也不是很复杂吧，如果搞清楚思路后。。。。 &#160;&#160;&#160; 根据&#8220;最小的权限+最少的服务=最大的安全&#8221;的原则&#160;&#160;&#160; 最小权限的设置：&#160;&#160;&#160; 使用NTFS系统文件格式，对每个硬盘根目录只给予administrator用户及system用户完全控制权限，并删除其他用户权限。&#160;&#160;&#160; 如：C:\Windows&#160; Administrator、System完全控制权限;Users用户默认权限不修改删除其他用户 &#160; &#160; &#160;&#160;&#160; 修改C:\Windows目录下相关可执行文件权限：&#160;&#160;&#160; net.exe、cmd.exe、tftp.exe、netstat.exe、regedit.exe、at.exe、attrib.exe、cacls.exe、format.com、regsvr32.exe、xcopy.exe、wscript.exe、cscript.exe、ftp.exe、telnet.exe、arp.exe、edlin.exe、ping.exe、route.exe、finger.exe、posix.exe、rsh.exe、atsvc.exe、qbasic.exe、runonce.exe、syskey.exe&#160;&#160;&#160; 修改以上权限，删除所有用户只保留Adminstrators和system用户组完全控制权限 &#160;&#160;&#160; 对于各个站点虚拟目录对应权限严格设置：&#160;&#160;&#160;&#160;&#160;&#160;&#160; 添加个站点或虚拟目录对应用户到GUESTS组&#160;&#160;&#160;&#160;&#160;&#160;&#160; Administraotrs 完全控制&#160;&#160;&#160;&#160;&#160;&#160;&#160; System 完全控制&#160;&#160;&#160;&#160;&#160;&#160;&#160; ASP.NET 读取写入&#160;&#160;&#160;&#160;&#160;&#160;&#160; NETWORK SERVICE 读取&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160; 禁止建立空链接：HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa新建 &#8220;DWORD值&#8221;值名为 &#8220;RestrictAnonymous&#8221; 数据值为&#8220;1&#8221; [2003默认为1] 禁止系统自动启动服务器共享：HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters新建 &#8220;DWORD值&#8221;值名为 &#8220;AutoShareServer&#8221; 数据值为&#8220;0&#8221; 禁止系统自动启动管理共享：HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters新建 &#8220;DWORD值&#8221;值名为 &#8220;AutoShareWks&#8221; 数据值为&#8220;0&#8221; 通过修改注册表防止小规模DDOS攻击HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters新建 &#8220;DWORD值&#8221;值名为 &#8220;SynAttackProtect&#8221; 数据值为&#8220;1&#8221; 本地安全策略配置:开始 &#62; 程序 &#62; 管理工具 &#62; 本地安全策略账户策略 &#62; [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;&nbsp; 这两天接触微软的windows server 2003搭建web服务器，实在是一个头两个大，对于安全防范及配置方面可谓是从未琢磨过，一次次的尝试一次次的验证修改，感觉其实也不是很复杂吧，如果搞清楚思路后。。。。</p>
<p>&nbsp;&nbsp;&nbsp; 根据&ldquo;最小的权限+最少的服务=最大的安全&rdquo;的原则<br />&nbsp;&nbsp;&nbsp; 最小权限的设置：<br />&nbsp;&nbsp;&nbsp; 使用NTFS系统文件格式，对每个硬盘根目录只给予administrator用户及system用户完全控制权限，并删除其他用户权限。<br />&nbsp;&nbsp;&nbsp; 如：C:\Windows&nbsp; Administrator、System完全控制权限;Users用户默认权限不修改删除其他用户</p>
<p>&nbsp; &nbsp; <img src="http://i3.6.cn/cvbnm/40/01/ce/521d0bb7578a4781fbb2ab065b6fe5d6.jpg" alt="" width="558" height="324" /><br />&nbsp;&nbsp;&nbsp; 修改C:\Windows目录下相关可执行文件权限：<br />&nbsp;&nbsp;&nbsp; net.exe、cmd.exe、tftp.exe、netstat.exe、regedit.exe、at.exe、attrib.exe、cacls.exe、format.com、regsvr32.exe、xcopy.exe、wscript.exe、cscript.exe、ftp.exe、telnet.exe、arp.exe、edlin.exe、ping.exe、route.exe、finger.exe、posix.exe、rsh.exe、atsvc.exe、qbasic.exe、runonce.exe、syskey.exe<br />&nbsp;&nbsp;&nbsp; 修改以上权限，删除所有用户只保留Adminstrators和system用户组完全控制权限</p>
<p>&nbsp;&nbsp;&nbsp; 对于各个站点虚拟目录对应权限严格设置：<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 添加个站点或虚拟目录对应用户到GUESTS组<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Administraotrs 完全控制<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System 完全控制<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ASP.NET 读取写入<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NETWORK SERVICE 读取<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img src="http://i3.6.cn/cvbnm/09/0b/49/b0c7b110341a61a13ff081a2b81bdd44.jpg" alt="" width="427" height="281" /></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img src="http://i3.6.cn/cvbnm/00/3e/e4/718843f457a38fc0304bade5c871e91a.jpg" alt="" width="498" height="313" /></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img src="http://i3.6.cn/cvbnm/33/7e/06/a27bc09ed48c76161473a1860975568f.jpg" alt="" width="508" height="319" /></p>
<p>禁止建立空链接：<br />HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa<br />新建 &ldquo;DWORD值&rdquo;值名为 &ldquo;RestrictAnonymous&rdquo; 数据值为&ldquo;1&rdquo; [2003默认为1]</p>
<p>禁止系统自动启动服务器共享：<br />HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters<br />新建 &ldquo;DWORD值&rdquo;值名为 &ldquo;AutoShareServer&rdquo; 数据值为&ldquo;0&rdquo;</p>
<p>禁止系统自动启动管理共享：<br />HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters<br />新建 &ldquo;DWORD值&rdquo;值名为 &ldquo;AutoShareWks&rdquo; 数据值为&ldquo;0&rdquo;</p>
<p>通过修改注册表防止小规模DDOS攻击<br />HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters<br />新建 &ldquo;DWORD值&rdquo;值名为 &ldquo;SynAttackProtect&rdquo; 数据值为&ldquo;1&rdquo;</p>
<p>本地安全策略配置:<br />开始 &gt; 程序 &gt; 管理工具 &gt; 本地安全策略<br />账户策略 &gt; 密码策略 &gt; <font color="#808000">密码最短使用期限 改成0天</font><br />账户策略 &gt; 账户锁定策略 &gt;<font color="#808000"> 账户锁定阈值 5 次 账户锁定时间 10分钟 [个人推荐配置]</font><br />本地策略 &gt; 审核策略 &gt;<br /><font color="#808000">账户管理 成功 失败<br />登录事件 成功 失败<br />对象访问 失败<br />策略更改 成功 失败<br />特权使用 失败<br />系统事件 成功 失败<br />目录服务访问 失败<br />账户登录事件 成功 失败</font><br />本地策略 &gt; 安全选项 &gt;<br /><font color="#808000">清除虚拟内存页面文件 更改为&quot;已启用&quot;<br />不显示上次的用户名 更改为&quot;已启用&quot;<br />不需要按CTRL+ALT+DEL 更改为&quot;已启用&quot;<br />不允许 SAM 账户的匿名枚举 更改为&quot;已启用&quot;<br />不允许 SAM 账户和共享的匿名枚举 更改为&quot;已启用&quot;<br />重命名来宾账户 更改成一个复杂的账户名<br />重命名系统管理员账号 更改一个自己用的账号 [同时可建立一个无用户组的Administrat账户]</font></p>
<p>删除不安全组件：<br />WScript.Shell 、Shell.application 两个组件一般一些ASP木马或一些恶意程序入侵渗透点。<br />方案一、<br />regsvr32 /u wshom.ocx 卸载WScript.Shell 组件<br />regsvr32 /u shell32.dll 卸载Shell.application 组件<br />方案二、<br />删除注册表 HKEY_CLASSES_ROOT\CLSID\{72C24DD5-D70A-438B-8A42-98424B88AFB8} 对应 WScript.Shell<br />删除注册表 HKEY_CLASSES_ROOT\CLSID\{13709620-C279-11CE-A49E-444553540000} 对应 Shell.application</p>
<p>最少的服务的设置：<br /><strong>黑色为自动</strong> <font color="#008000">绿色为手动</font> <font color="#ff0000">红色为禁用</font><br /><font color="#ff0000">Alerter</font><br />服务描述: 通知选定的用户和计算机管理警报。如果服务停止，使用管理警报的程序将不会收到它们。如果此服务被禁用，任何直接依赖它的服务都将不能启动。<br /><font color="#008000">Application Experience Lookup Service<br />Application Layer Gateway Service</font><br />服务描述: 为应用程序级协议插件提供支持并启用网络/协议连接。如果此服务被禁用，任何依赖它的服务将无法启动。<br /><font color="#008000">Application Management<br /><font color="#000000"><strong>Automatic Updates [Windows自动更新,可选项]</strong></font> <br />Background Intelligent Transfer Service</font><br />服务描述: 服务描述:利用空闲的网络带宽在后台传输文件。如果服务被停用，例如 Windows Update 和 MSN Explorer 的功能将无法自动下载程序和其他信息。如果此服务被禁用，任何依赖它的服务如果没有容错技术以直接通过 IE 传输文件，一旦 BITS 被禁用，就可能无法传输文件。<br /><font color="#ff0000">ClipBook</font><br /><strong>COM+ Event System</strong><br /><font color="#008000">COM+ System Application<br />Computer Browser</font><br />服务描述: 服务描述:维护网络上计算机的更新列表，并将列表提供给计算机指定浏览。如果服务停止，列表不会被更新或维护。如果服务被禁用，任何直接依赖于此服务的服务将无法启动。<br /><font color="#008000">Cryptographic Services</font><br /><strong>DCOM Server Process Launcher</strong><br /><font color="#008000">DHCP Client<br />Distributed File System</font><br />服务描述: 将分散的文件共享合并成一个逻辑名称空间并在局域网或广域网上管理这些逻辑卷。如果这个服务被停止，用户则无法访问文件共享。如果这个服务被禁用，任何依赖它的服务将无法启动。<br /><strong>Distributed Link Tracking Client</strong><br /><font color="#ff0000">Distributed Link Tracking Server</font><br /><font color="#008000">Distributed Transaction Coordinator</font><br /><font color="#008000">DNS Client<br />Error Reporting Service<br /><strong><font color="#000000">Event Log</font></strong></font><br /><font color="#ff0000">File Replication</font><br /><font color="#ff0000">Help and Support</font><br />服务描述: 启用在此计算机上运行帮助和支持中心。如果停止服务，帮助和支持中心将不可用。如果禁用服务，任何直接依赖于此服务的服务将无法启动。<br /><font color="#008000">HTTP SSL<br />Human Interface Device Access</font><br /><strong>IIS Admin Service</strong><br /><font color="#ff0000">IMAPI CD-Burning COM Service</font><br /><font color="#ff0000">Indexing Service</font><br /><font color="#ff0000">Intersite Messaging</font><br /><font color="#ff0</p>
<p>000">IPSEC Services [如果使用了IP安全策略则自动，如无则禁用，可选操作] <br />Kerberos Key Distribution Center<br />License Logging</font><br /><strong>Logical Disk Manager [可选，多硬盘建议自动] </strong><br /><font color="#008000">Logical Disk Manager Administrative Service</font><br /><font color="#ff0000">Messenger</font><br />服务描述: 传输客户端和服务器之间的 NET SEND 和 警报器服务消息。此服务与 Windows Messenger 无关。如果服务停止，警报器消息不会被传输。如果服务被禁用，任何直接依赖于此服务的服务将无法启动。<br /><strong>Microsoft Search</strong><br /><font color="#008000">Microsoft Software Shadow Copy Provider</font><br /><strong>MSSQLSERVER</strong><br /><font color="#008000">MSSQLServerADHelper<br />Net Logon</font><br /><font color="#ff0000">NetMeeting Remote Desktop Sharing</font><br />服务描述: 允许经过授权的用户用 NetMeeting 在公司 intranet 上远程访问这台计算机。如果服务被停止，远程桌面共享将不可用。如果服务被禁用，依赖这个服务的任何服务都会无法启动。<br /><font color="#008000">Network Connections</font><br /><font color="#ff0000">Network DDE<br />Network DDE DSDM</font><br /><font color="#008000">Network Location Awareness (NLA)<br />Network Provisioning Service<br />NT LM Security Support Provider<br />Performance Logs and Alerts</font><br /><strong>Plug and Play</strong><br /><font color="#ff0000">Portable Media Serial Number Service [微软反盗版工具，目前只针对多媒体类] <br />Print Spooler</font><br />服务描述: 管理所有本地和网络打印队列及控制所有打印工作。如果此服务被停用，本地计算机上的打印将不可用。如果此服务被禁用，任何依赖于它的服务将无法启用。<br /><strong>Protected Storage</strong><br /><font color="#008000">Remote Access Auto Connection Manager<br />Remote Access Connection Manager<br />Remote Desktop Help Session Manager</font><br /><strong>Remote Procedure Call (RPC)</strong><br /><font color="#008000">Remote Procedure Call (RPC) Locator</font><br /><font color="#ff0000">Remote Registry</font><br />服务描述: 使远程用户能修改此计算机上的注册表设置。如果此服务被终止，只有此计算机上的用户才能修改注册表。如果此服务被禁用，任何依赖它的服务将无法启动。<br /><font color="#008000">Removable Storage<br />Resultant Set of Policy Provider</font><br /><font color="#ff0000">Routing and Remote Access</font><br /><font color="#ff0000">Secondary Logon</font><br /><strong>Security Accounts Manager</strong><br /><font color="#008000">Server</font><br /><font color="#ff0000">Shell Hardware Detection</font><br /><font color="#008000">Smart Card<br />Special Administration Console Helper<br />SQLSERVERAGENT</font><br />System Event Notification<br /><font color="#ff0000">Task Scheduler</font><br />服务描述: 使用户能在此计算机上配置和计划自动任务。如果此服务被终止，这些任务将无法在计划时间里运行。如果此服务被禁用，任何依赖它的服务将无法启动。<br /><font color="#ff0000">TCP/IP NetBIOS Helper</font><br />服务描述: 提供 TCP/IP (NetBT) 服务上的 NetBIOS 和网络上客户端的 NetBIOS 名称解析的支持，从而使用户能够共享文件、打印和登录到网络。如果此服务被停用，这些功能可能不可用。如果此服务被禁用，任何依赖它的服务将无法启动。<br /><font color="#008000">Telephony</font><br /><font color="#ff0000">Telnet</font><br />服务描述: 允许远程用户登录到此计算机并运行程序，并支持多种 TCP/IP Telnet 客户端，包括基于 UNIX 和 Windows 的计算机。如果此服务停止，远程用户就不能访问程序，任何直接依赖于它的服务将会启动失败。<br />Terminal Services<br /><font color="#ff0000">Terminal Services Session Directory<br />Themes</font><br /><font color="#008000">Uninterruptible Power Supply<br />Upload Manager<br />Virtual Disk Service<br />Volume Shadow Copy</font><br /><font color="#ff0000">WebClient<br />Windows Audio [服务器没必要使用声音] <br />Windows Firewall/Internet Connection Sharing (ICS)<br />Windows Image Acquisition (WIA)</font><br /><font color="#008000">Windows Installer</font><br /><strong>Windows Management Instrumentation</strong><br /><font color="#008000">Windows Management Instrumentation Driver Extensions</font><br /><font color="#ff0000">Windows Time</font><br /><font color="#008000">Windows User Mode Driver Framework<br />WinHTTP Web Proxy Auto-Discovery Service</font><br /><strong>Wireless Configuration</strong><br /><font color="#008000">WMI Performance Adapter<br />Workstation</font><br />服务描述: 创建和维护到远程服务的客户端网络连接。如果服务停止，这些连接将不可用。如果服务被禁用，任何直接依赖于此服务的服务将无法启动。<br /><strong>World Wide Web Publishing Service</strong></p>
<p>基于IIS6.0安装配置PHP程序支持：<br />先安装php使用最新版本php-5.2.8-win32-installer.msi<br />安装过程中选择所设置的the web server 为IIS ISAPI module如图所示：</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img src="http://i3.6.cn/cvbnm/97/3b/87/ee5afcba2f1492e88f578a07e57a204b.jpg" alt="" width="444" height="343" /></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img src="http://i3.6.cn/cvbnm/92/37/71/9ac217c084fd631cdb4c17884bc9e842.jpg" alt="" width="460" height="356" /><br />&nbsp;&nbsp;&nbsp; 紧接着简单配置IIS完成站点c.com支持PHP程序<br />&nbsp;&nbsp;&nbsp; 站点属性&#8211;&gt;主目录&#8211;&gt;配置&#8211;&gt;应用程序扩展&#8211;&gt;添加 可执行文件：C:\PHP\php5isapi.dll&nbsp;&nbsp; 格式为：.php <br />如下图所示：</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; <img src="http://i3.6.cn/cvbnm/9c/a7/d0/99ab5a98d847bd2ca0b1a6fbe93faa37.jpg" alt="" width="511" height="440" /><br />&nbsp;&nbsp;&nbsp; 添加相应支持php程序&ldquo;web服务扩展&rdquo;，即打开&ldquo; Internet 信息服务(IIS)管理器&rdquo;，在&ldquo; Web 服务扩展&rdquo;里，选择&ldquo;添加一个新的 Web 服务扩展&rdquo;，扩展名可填写&ldquo;PHP&rdquo;，要求的文件选择: C:\PHP\php5isapi.dll，并设置扩展状态为允许。结果如下图所示：</p>
<p>&nbsp;&nbsp;&nbsp; <img src="http://i3.6.cn/cvbnm/47/9f/bc/999579771891e8165359c653118a792d.jpg" alt="" width="424" height="476" /><br />&nbsp;&nbsp;&nbsp; 打开&ldquo;网站&rdquo;-&gt;&ldquo;属性&rdquo;-&gt;&ldquo;文档&rdquo;-&gt;&ldquo;启用默认内容文档&rdquo;-&gt;&ldquo;添加&rdquo;，可以将 index.php 添加为默认内容文档。最后并重新启动IIS服务项。<br />&nbsp;&nbsp;&nbsp; 最后使用phpinfo();函数测试结果</p>
<p>&nbsp; &nbsp; <img src="http://i3.6.cn/cvbnm/23/09/f8/081e712fc3583454e3ec327d947058ba.jpg" alt="" width="558" height="428" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yousri.org/2008/12/22/windows-server-2003-install-and-setting.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
