<?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>半瓶 &#187; 主机及存储</title>
	<atom:link href="http://www.banping.com/category/hoststorage/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.banping.com</link>
	<description>一瓶子不满  半瓶子晃荡</description>
	<lastBuildDate>Wed, 28 Jul 2010 14:11:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>配置Linux防火墙的一些方法</title>
		<link>http://www.banping.com/2010/04/30/linux_iptables/</link>
		<comments>http://www.banping.com/2010/04/30/linux_iptables/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 09:07:55 +0000</pubDate>
		<dc:creator>banping</dc:creator>
				<category><![CDATA[主机及存储]]></category>

		<guid isPermaLink="false">http://www.banping.com/?p=694</guid>
		<description><![CDATA[首先查看一下现有的防火墙配置：
[root@localhost banping]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -p tcp -m tcp --dport 8000 -j ACCEPT
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 [...]]]></description>
			<content:encoded><![CDATA[<p>首先查看一下现有的防火墙配置：</p>
<blockquote><p>[root@localhost banping]# vi /etc/sysconfig/iptables</p>
<p># Firewall configuration written by system-config-securitylevel<br />
# Manual customization of this file is not recommended.<br />
*filter<br />
:INPUT ACCEPT [0:0]<br />
:FORWARD ACCEPT [0:0]<br />
:OUTPUT ACCEPT [0:0]<br />
:RH-Firewall-1-INPUT - [0:0]<br />
-A INPUT -p tcp -m tcp --dport 8000 -j ACCEPT<br />
-A INPUT -j RH-Firewall-1-INPUT<br />
-A FORWARD -j RH-Firewall-1-INPUT<br />
-A RH-Firewall-1-INPUT -i lo -j ACCEPT<br />
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT<br />
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT<br />
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT<br />
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT<br />
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT<br />
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT<br />
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT<br />
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT<br />
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 23 -j ACCEPT<br />
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited</p></blockquote>
<p>查看现有的策略：</p>
<blockquote><p>[root@localhost banping]# iptables -L -n<br />
Chain INPUT (policy ACCEPT)<br />
target     prot opt source               destination<br />
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:8000<br />
RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0</p>
<p>Chain FORWARD (policy ACCEPT)<br />
target     prot opt source               destination<br />
RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0</p>
<p>Chain OUTPUT (policy ACCEPT)<br />
target     prot opt source               destination</p>
<p>Chain RH-Firewall-1-INPUT (2 references)<br />
target     prot opt source               destination<br />
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0<br />
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           icmp type 255<br />
ACCEPT     esp  --  0.0.0.0/0            0.0.0.0/0<br />
ACCEPT     ah   --  0.0.0.0/0            0.0.0.0/0<br />
ACCEPT     udp  --  0.0.0.0/0            224.0.0.251         udp dpt:5353<br />
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:631<br />
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:631<br />
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED<br />
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22<br />
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:23<br />
REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited</p></blockquote>
<p>如果要重新配置，先清空之前的策略：</p>
<blockquote><p>[root@localhost banping]# iptables -F<br />
[root@localhost banping]# iptables -X<br />
[root@localhost banping]# iptables -L -n<br />
Chain INPUT (policy ACCEPT)<br />
target     prot opt source               destination</p>
<p>Chain FORWARD (policy ACCEPT)<br />
target     prot opt source               destination</p>
<p>Chain OUTPUT (policy ACCEPT)<br />
target     prot opt source               destination</p></blockquote>
<p>先配置开放22端口，否则如果是远程登入的，会把自己关在外面：</p>
<blockquote><p>[root@localhost banping]# iptables -A INPUT -p tcp --dport 22 -j ACCEPT</p></blockquote>
<p>然后丢弃所有的input，根据需要配置开放的就行了：</p>
<blockquote><p>[root@localhost banping]# iptables -P INPUT DROP<br />
[root@localhost banping]# iptables -P OUTPUT ACCEPT<br />
[root@localhost banping]# iptables -P FORWARD ACCEPT</p></blockquote>
<p>然后要保存一下：</p>
<blockquote><p>[root@localhost banping]# /etc/rc.d/init.d/iptables save<br />
将当前规则保存到 /etc/sysconfig/iptables：[确定]</p></blockquote>
<p>重启防火墙服务：</p>
<blockquote><p>[root@localhost banping]# service iptables restart<br />
清除防火墙规则：[确定]<br />
把 chains 设置为 ACCEPT 策略：filter [确定]<br />
正在卸载 Iiptables 模块：[确定]<br />
应用 iptables 防火墙规则：[确定]<br />
载入额外 iptables 模块：ip_conntrack_netbios_ns [确定]</p></blockquote>
<p>除了用iptables命令，也可以直接编辑/etc/sysconfig/iptables文件，最终的配置结果可能如下，：</p>
<blockquote><p>[root@localhost banping]# vi /etc/sysconfig/iptables</p>
<p># Generated by iptables-save v1.3.5 on Thu Apr 29 17:28:08 2010<br />
*filter<br />
:INPUT DROP [3:349]<br />
:FORWARD ACCEPT [0:0]<br />
:OUTPUT ACCEPT [5585:947488]<br />
-A INPUT -i lo -j ACCEPT<br />
-A INPUT -s 172.16.0.1 -i eth0 -p tcp -m tcp --dport 22 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT<br />
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT<br />
-A INPUT -s 172.16.0.2 -i eth0 -j ACCEPT<br />
-A INPUT -s 172.16.0.3 -i eth0 -j ACCEPT<br />
COMMIT<br />
# Completed on Thu Apr 29 17:28:08 2010</p></blockquote>
<p>可见，这里的配置允许指定的IP访问22端口，开放80端口，不限制下边的两个IP进行连接。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.banping.com/2010/04/30/linux_iptables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在Linux下安装JDK和tomcat</title>
		<link>http://www.banping.com/2010/02/23/install_jdk_tomcat/</link>
		<comments>http://www.banping.com/2010/02/23/install_jdk_tomcat/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 09:03:00 +0000</pubDate>
		<dc:creator>banping</dc:creator>
				<category><![CDATA[主机及存储]]></category>

		<guid isPermaLink="false">http://www.banping.com/?p=617</guid>
		<description><![CDATA[在Linux 安装JDK和Tomcat 很简单，简要介绍如下：
首先去下载软件，地址分别是
http://java.sun.com/javase/downloads/index.jsp
和
http://tomcat.apache.org/
注意选择自己需要的合适的版本，比如我下载的是apache-tomcat-5.5.23.tar.gz和jdk-6u18-linux-x64-rpm.bin.gz，然后上传到/tmp目录下。
安装JDK：
[root@tomcat1 tmp]# sh jdk-6u18-linux-x64-rpm.bin
Sun Microsystems, Inc. Binary Code License Agreement
for the JAVA SE DEVELOPMENT KIT (JDK), VERSION 6
......
Do you agree to the above license terms? [yes or no]
           yes
Unpacking...
Checksumming...
Extracting...
......
Press Enter to continue.....
Done.
安装完成后，JDK被安装在/usr/java目录下。这个版本会在当前路径下安装javaDB，以前的版本不会。
安装tomcat ：
[root@tomcat1 tmp]# tar -zxvf apache-tomcat-5.5.23.tar.gz
然后会在当前路径下生成apache-tomcat-5.5.23文件夹，把它mv或cp到你想要的路径即可。
[root@tomcat1 tmp]# cp -a apache-tomcat-5.5.23 /usr/local/
然后配置环境变量：
[root@tomcat1 tmp]# vi /etc/profile
#set java environment
JAVA_HOME=/usr/java/jdk1.6.0_18
export TOMCAT_HOME=/usr/local/apache-tomcat-5.5.23
CLASSPATH=.:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
[root@tomcat1 tmp]# source [...]]]></description>
			<content:encoded><![CDATA[<p>在Linux 安装JDK和Tomcat 很简单，简要介绍如下：</p>
<p>首先去下载软件，地址分别是</p>
<p><a href="http://java.sun.com/javase/downloads/index.jsp">http://java.sun.com/javase/downloads/index.jsp</a></p>
<p>和</p>
<p><a href="http://tomcat.apache.org/">http://tomcat.apache.org/</a></p>
<p>注意选择自己需要的合适的版本，比如我下载的是apache-tomcat-5.5.23.tar.gz和jdk-6u18-linux-x64-rpm.bin.gz，然后上传到/tmp目录下。</p>
<p>安装JDK：</p>
<blockquote><p>[root@tomcat1 tmp]# sh jdk-6u18-linux-x64-rpm.bin</p>
<p>Sun Microsystems, Inc. Binary Code License Agreement</p>
<p>for the JAVA SE DEVELOPMENT KIT (JDK), VERSION 6</p>
<p>......</p>
<p>Do you agree to the above license terms? [yes or no]<br />
           yes<br />
Unpacking...<br />
Checksumming...<br />
Extracting...</p>
<p>......</p>
<p>Press Enter to continue.....<br />
Done.</p></blockquote>
<p>安装完成后，JDK被安装在/usr/java目录下。这个版本会在当前路径下安装javaDB，以前的版本不会。</p>
<p>安装tomcat ：</p>
<blockquote><p>[root@tomcat1 tmp]# tar -zxvf apache-tomcat-5.5.23.tar.gz</p></blockquote>
<p>然后会在当前路径下生成apache-tomcat-5.5.23文件夹，把它mv或cp到你想要的路径即可。</p>
<blockquote><p>[root@tomcat1 tmp]# cp -a apache-tomcat-5.5.23 /usr/local/</p></blockquote>
<p>然后配置环境变量：</p>
<blockquote><p>[root@tomcat1 tmp]# vi /etc/profile</p>
<p>#set java environment<br />
JAVA_HOME=/usr/java/jdk1.6.0_18<br />
export TOMCAT_HOME=/usr/local/apache-tomcat-5.5.23</p>
<p>CLASSPATH=.:$JAVA_HOME/lib/tools.jar<br />
PATH=$JAVA_HOME/bin:$PATH<br />
export JAVA_HOME CLASSPATH PATH</p>
<p>[root@tomcat1 tmp]# source /etc/profile</p></blockquote>
<p>查看java的版本号已经生效了：</p>
<blockquote><p>[root@tomcat1 tmp]# java -version<br />
java version "1.6.0_18"<br />
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)<br />
Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)</p></blockquote>
<p>测试tomcat ：</p>
<blockquote><p>[root@tomcat1 tmp]# cd /usr/local/apache-tomcat-5.5.23/bin/</p>
<p>[root@tomcat1 bin]# ./startup.sh<br />
Using CATALINA_BASE:   /usr/local/apache-tomcat-5.5.23<br />
Using CATALINA_HOME:   /usr/local/apache-tomcat-5.5.23<br />
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-5.5.23/temp<br />
Using JRE_HOME:       /usr/java/jdk1.6.0_18</p></blockquote>
<p>打开网页查看8080端口就能看到可爱的猫了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.banping.com/2010/02/23/install_jdk_tomcat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>收集IBM小型机的snap信息</title>
		<link>http://www.banping.com/2010/01/20/collect_ibm_snap/</link>
		<comments>http://www.banping.com/2010/01/20/collect_ibm_snap/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 02:48:47 +0000</pubDate>
		<dc:creator>banping</dc:creator>
				<category><![CDATA[主机及存储]]></category>

		<guid isPermaLink="false">http://www.banping.com/?p=604</guid>
		<description><![CDATA[用root用户登录，首先清除原来的snap信息：
p5a1@/#snap -r
The following directories and files will be deleted:
-----------------------------------------------------------
/tmp/ibmsupt/general (directory)
/tmp/ibmsupt/other (directory)
/tmp/ibmsupt/testcase (directory)
/tmp/ibmsupt/ssa (directory)
/tmp/ibmsupt/pcixscsi (directory)
/tmp/ibmsupt/snap.pax.Z (file)
Do you want me to remove these directories (y/n)? y
Removing... done.
如果以前未做过snap，会提示：
nothing to clean up
清理完成后可以开始收集：
p5a1@/#snap -gbLc
/var/adm/ras/trcfile: No such file or directory
Checking space requirement for general information.... done.
.********Checking and initializing directory structure
Creating /tmp/ibmsupt/svCollect directory tree... done.
Creating /tmp/ibmsupt/client_collect directory tree... done.
Creating /tmp/ibmsupt/lvm directory tree... [...]]]></description>
			<content:encoded><![CDATA[<p>用root用户登录，首先清除原来的snap信息：</p>
<blockquote><p>p5a1@/#snap -r</p>
<p>The following directories and files will be deleted:<br />
-----------------------------------------------------------<br />
/tmp/ibmsupt/general (directory)<br />
/tmp/ibmsupt/other (directory)<br />
/tmp/ibmsupt/testcase (directory)<br />
/tmp/ibmsupt/ssa (directory)<br />
/tmp/ibmsupt/pcixscsi (directory)<br />
/tmp/ibmsupt/snap.pax.Z (file)</p>
<p>Do you want me to remove these directories (y/n)? y<br />
Removing... done.</p></blockquote>
<p>如果以前未做过snap，会提示：</p>
<blockquote><p>nothing to clean up</p></blockquote>
<p>清理完成后可以开始收集：</p>
<blockquote><p>p5a1@/#snap -gbLc<br />
/var/adm/ras/trcfile: No such file or directory<br />
Checking space requirement for general information.... done.<br />
.********Checking and initializing directory structure<br />
Creating /tmp/ibmsupt/svCollect directory tree... done.<br />
Creating /tmp/ibmsupt/client_collect directory tree... done.<br />
Creating /tmp/ibmsupt/lvm directory tree... done.<br />
Creating /tmp/ibmsupt/ssa directory tree... done.<br />
Creating /tmp/ibmsupt/general directory tree... done.<br />
Creating /tmp/ibmsupt/general/diagnostics directory tree... done.<br />
Creating /tmp/ibmsupt/pcixscsi directory tree... done.<br />
Creating /tmp/ibmsupt/testcase directory tree... done.<br />
Creating /tmp/ibmsupt/other directory tree... done.<br />
********Finished setting up directory /tmp/ibmsupt</p>
<p>Checking Space requirement for svCollect<br />
The script svCollect is not executable in /usr/lib/ras/snapscripts<br />
Checking Space requirement for client_collect<br />
Checking space requirement for ssa information.......... done.<br />
Checking space requirement for logical volume manager information......<br />
Checking space requirement for Enhanced CLVM information..../tmp/ch.log.* not found<br />
done.<br />
Checking for enough free space in filesystem... done.</p>
<p>/var/adm/ras/trcfile: No such file or directory<br />
Gathering general system information............ done.<br />
Gathering platform/scanout information.done.<br />
Gathering svCollect data<br />
The script svCollect is not executable in /usr/lib/ras/snapscripts<br />
Gathering client_collect data<br />
Gathering pcixscsi system information........... done.<br />
Gathering ssa system information.......... done.<br />
Gathering logical volume manager information..........<br />
Gathering Enhanced CLVM information..../tmp/ch.log.* not found<br />
done.</p>
<p>Creating compressed pax file...<br />
Starting pax/compress process... Please wait... done.</p>
<p>-rw-------   1 0        0           1259857 Jan 20 09:24 snap.pax.Z</p></blockquote>
<p>可以根据需要指定不同的参数，<span style="font-family: Microsoft YaHei; color: #000000;">b是收集 SSA  信息，f是收集文件系统信息</span>：</p>
<blockquote><p>p5a1@/#snap -gLfc<br />
/var/adm/ras/trcfile: No such file or directory<br />
Checking space requirement for general information.................................. done.<br />
.********Checking and initializing directory structure<br />
Creating /tmp/ibmsupt/svCollect directory tree... done.<br />
Creating /tmp/ibmsupt/client_collect directory tree... done.<br />
Creating /tmp/ibmsupt/lvm directory tree... done.<br />
Creating /tmp/ibmsupt/filesys directory tree... done.<br />
Creating /tmp/ibmsupt/general directory tree... done.<br />
Creating /tmp/ibmsupt/general/diagnostics directory tree... done.<br />
Creating /tmp/ibmsupt/pcixscsi directory tree... done.<br />
Creating /tmp/ibmsupt/testcase directory tree... done.<br />
Creating /tmp/ibmsupt/other directory tree... done.<br />
********Finished setting up directory /tmp/ibmsupt</p>
<p>Checking Space requirement for svCollect<br />
The script svCollect is not executable in /usr/lib/ras/snapscripts<br />
Checking Space requirement for client_collect<br />
Checking space requirement for filesys information................done.<br />
Checking space requirement for logical volume manager information.....................<br />
Checking space requirement for Enhanced CLVM information..../tmp/ch.log.* not found<br />
done.<br />
Checking for enough free space in filesystem... done.</p>
<p>/var/adm/ras/trcfile: No such file or directory<br />
Gathering general system information......................done.<br />
Gathering platform/scanout information.done.<br />
Gathering svCollect data<br />
The script svCollect is not executable in /usr/lib/ras/snapscripts<br />
Gathering client_collect data<br />
Gathering pcixscsi system information...........................<br />
Gathering filesys system information........done.<br />
Gathering logical volume manager information...............<br />
Gathering Enhanced CLVM information..../tmp/ch.log.* not found<br />
done.</p>
<p>Creating compressed pax file...<br />
Starting pax/compress process... Please wait... done.</p>
<p>-rw-------   1 0        0           1383719 Jun 17 10:29 snap.pax.Z</p></blockquote>
<p>收集完成后，通过ftp就可以拿下这个文件了：</p>
<blockquote><p>Microsoft Windows XP [版本 5.1.2600]<br />
(C) 版权所有 1985-2001 Microsoft Corp.</p>
<p>C:\Documents and Settings\banping&gt;ftp 172.16.0.62<br />
Connected to 172.16.0.62.<br />
220 p5a1 FTP server (Version 4.2 Thu Jul 12 13:39:06 CDT 2007) ready.<br />
User (172.16.0.62:(none)): root<br />
331 Password required for root.<br />
Password:<br />
230-Last unsuccessful login: Sat Jan 16 09:43:39 BEIST 2010 on /dev/pts/0 from i<br />
user.banping.com<br />
230-Last login: Tue Jan 19 09:10:37 BEIST 2010 on ftp from user.banping.com<br />
230 User root logged in.<br />
ftp&gt; bin<br />
200 Type set to I.<br />
ftp&gt; get /tmp/ibmsupt/snap.pax.Z<br />
200 PORT command successful.<br />
150 Opening data connection for /tmp/ibmsupt/snap.pax.Z (1259857 bytes).<br />
226 Transfer complete.<br />
ftp: 收到 1259857 字节，用时 0.09Seconds 13402.73Kbytes/sec.</p></blockquote>
<p>去user用户的document目录下就能拿到这个文件了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.banping.com/2010/01/20/collect_ibm_snap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用Linux自带的gssftp服务</title>
		<link>http://www.banping.com/2010/01/12/linux_gssftp/</link>
		<comments>http://www.banping.com/2010/01/12/linux_gssftp/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 09:03:40 +0000</pubDate>
		<dc:creator>banping</dc:creator>
				<category><![CDATA[主机及存储]]></category>

		<guid isPermaLink="false">http://www.banping.com/?p=586</guid>
		<description><![CDATA[RedHat和CentOS都自带了一个gssftp服务，使用方式如下：
[root@linux local]# cd /etc/xinetd.d
[root@linux xinetd.d]# ls
chargen      cups-lpd  daytime-udp  echo-udp  gssftp  krb5-telnet  rsync  time-udp
chargen-udp  daytime   echo         eklogin   klogin  kshell       time
编辑gssftp文件，将server_args改为-l，将disable改为no：
[root@linux xinetd.d]# vi gssftp
# default: off
# [...]]]></description>
			<content:encoded><![CDATA[<p>RedHat和CentOS都自带了一个gssftp服务，使用方式如下：</p>
<blockquote><p>[root@linux local]# cd /etc/xinetd.d<br />
[root@linux xinetd.d]# ls<br />
chargen      cups-lpd  daytime-udp  echo-udp  gssftp  krb5-telnet  rsync  time-udp<br />
chargen-udp  daytime   echo         eklogin   klogin  kshell       time</p></blockquote>
<p>编辑gssftp文件，将server_args改为-l，将disable改为no：</p>
<blockquote><p>[root@linux xinetd.d]# vi gssftp</p>
<p># default: off<br />
# description: The kerberized FTP server accepts FTP connections \<br />
#              that can be authenticated with Kerberos 5.<br />
service ftp<br />
{<br />
flags           = REUSE<br />
socket_type     = stream<br />
wait            = no<br />
user            = root<br />
server          = /usr/kerberos/sbin/ftpd<br />
#server_args    = -l -a<br />
server_args     = -l<br />
log_on_failure  += USERID<br />
#disable                = yes<br />
disable         = no<br />
}</p></blockquote>
<p>重启xinetd服务：</p>
<blockquote><p>[root@linux xinetd.d]# service xinetd restart<br />
Stopping xinetd: [  OK  ]<br />
Starting xinetd: [  OK  ]</p></blockquote>
<p>这时查看21端口已经打开：</p>
<blockquote><p>[root@linux xinetd.d]# netstat -tnlp<br />
Active Internet connections (only servers)<br />
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name<br />
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      22543/xinetd</p></blockquote>
<p>如果防火墙没有打开端口，则开放21端口并重启防火墙服务：</p>
<blockquote><p>[root@linux xinetd.d]# vi /etc/sysconfig/iptables</p>
<p>[root@linux xinetd.d]# service iptables restart<br />
Flushing firewall rules: [  OK  ]<br />
Setting chains to policy ACCEPT: filter [  OK  ]<br />
Unloading iptables modules: [  OK  ]<br />
Applying iptables firewall rules: [  OK  ]</p></blockquote>
<p>这样ftp服务就可用了，可以使用linux系统用户登录，不过gssftp不够安全，临时应急或内部使用可以，稳定的FTP服务还是建议使用<a href="http://www.banping.com/2009/06/23/linux_64_vsftpd/">vsftp</a>来搭建。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.banping.com/2010/01/12/linux_gssftp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用script记录Linux用户的操作记录</title>
		<link>http://www.banping.com/2009/12/17/script_linux_log/</link>
		<comments>http://www.banping.com/2009/12/17/script_linux_log/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 13:54:34 +0000</pubDate>
		<dc:creator>banping</dc:creator>
				<category><![CDATA[主机及存储]]></category>

		<guid isPermaLink="false">http://www.banping.com/?p=570</guid>
		<description><![CDATA[有时候我们需要记录Linux用户的操作记录用于审计，因此就要避免用户可以自行清除操作日志，一个简单的方式是使用script功能。
首先在用户的profile文件中开启记录功能：
[banping@linux ~]$ cd /home/banping/
[banping@linux ~]$ vi .bash_profile
# write log
exec /usr/bin/script -a -f -q /tmp/test/script-`date +%Y%m%d%k%M`.lst
这行脚本的意思是在/tmp/test目录下以时间为文件名来记录操作信息，由于是写在了.bash_profile文件中，用户登入到Linux系统的时候就会触发执行。
然后我们在/tmp下建立test目录存放操作日志信息即可：
[banping@linux tmp]# mkdir test
这样就实现了记录的功能，而要防止用户自行修改，我们可以设置这些文件只能被附加，不能被修改或删除：
[root@linux banping]# chattr +a .bash_profile
[root@linux tmp]# chattr +a -R test
这样登录用户就无法修改这些信息了，以下是一个简单的测试：
[root@tomcat tmp]# cd test
[root@tomcat test]# touch 1.txt
[root@tomcat test]# rm 1.txt
rm: remove regular empty file `1.txt'? y
rm: cannot remove `1.txt': Operation not permitted
[root@tomcat test]# cd ..
[root@tomcat tmp]# chattr -a -R [...]]]></description>
			<content:encoded><![CDATA[<p>有时候我们需要记录Linux用户的操作记录用于审计，因此就要避免用户可以自行清除操作日志，一个简单的方式是使用script功能。</p>
<p>首先在用户的profile文件中开启记录功能：</p>
<blockquote><p>[banping@linux ~]$ cd /home/banping/<br />
[banping@linux ~]$ vi .bash_profile<br />
# write log<br />
exec /usr/bin/script -a -f -q /tmp/test/script-`date +%Y%m%d%k%M`.lst</p></blockquote>
<p>这行脚本的意思是在/tmp/test目录下以时间为文件名来记录操作信息，由于是写在了.bash_profile文件中，用户登入到Linux系统的时候就会触发执行。</p>
<p>然后我们在/tmp下建立test目录存放操作日志信息即可：</p>
<blockquote><p>[banping@linux tmp]# mkdir test</p></blockquote>
<p>这样就实现了记录的功能，而要防止用户自行修改，我们可以设置这些文件只能被附加，不能被修改或删除：</p>
<blockquote><p>[root@linux banping]# chattr +a .bash_profile</p>
<p>[root@linux tmp]# chattr +a -R test</p></blockquote>
<p>这样登录用户就无法修改这些信息了，以下是一个简单的测试：</p>
<blockquote><p>[root@tomcat tmp]# cd test<br />
[root@tomcat test]# touch 1.txt<br />
[root@tomcat test]# rm 1.txt<br />
rm: remove regular empty file `1.txt'? y<br />
rm: cannot remove `1.txt': Operation not permitted<br />
[root@tomcat test]# cd ..<br />
[root@tomcat tmp]# chattr -a -R test<br />
[root@tomcat tmp]# cd test<br />
[root@tomcat test]# rm 1.txt<br />
rm: remove regular empty file `1.txt'? y</p></blockquote>
<p>结合<a href="http://www.banping.com/2009/11/16/linux_remote_logfile/" target="_blank">登录文件的安全保存</a>和防火墙功能，可以实现一个简单而完整的安全审计解决方案。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.banping.com/2009/12/17/script_linux_log/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Linux与网络相关的一些文件</title>
		<link>http://www.banping.com/2009/11/18/linux_network_file/</link>
		<comments>http://www.banping.com/2009/11/18/linux_network_file/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 08:31:57 +0000</pubDate>
		<dc:creator>banping</dc:creator>
				<category><![CDATA[主机及存储]]></category>

		<guid isPermaLink="false">http://www.banping.com/?p=556</guid>
		<description><![CDATA[Linux的网络相关配置记录在了很多文件中，记录一下。
查看网卡是否被内核识别：
[root@linux ~]# dmesg&#124;grep -in eth
150:divert: not allocating divert_blk for non-ethernet device lo
239:divert: allocating divert_blk for eth0
240:e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection
366:divert: not allocating divert_blk for non-ethernet device sit0
389:ADDRCONF(NETDEV_UP): eth0: link is not ready
390:e1000: eth0: e1000_watchdog_task: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
391:ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
394:eth0: no IPv6 routers present
主机名称：
[root@linux [...]]]></description>
			<content:encoded><![CDATA[<p>Linux的网络相关配置记录在了很多文件中，记录一下。</p>
<p>查看网卡是否被内核识别：</p>
<blockquote><p>[root@linux ~]# dmesg|grep -in eth<br />
150:divert: not allocating divert_blk for non-ethernet device lo<br />
239:divert: allocating divert_blk for eth0<br />
240:e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection<br />
366:divert: not allocating divert_blk for non-ethernet device sit0<br />
389:ADDRCONF(NETDEV_UP): eth0: link is not ready<br />
390:e1000: eth0: e1000_watchdog_task: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None<br />
391:ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready<br />
394:eth0: no IPv6 routers present</p></blockquote>
<p>主机名称：</p>
<blockquote><p>[root@linux ~]# cat /etc/sysconfig/network<br />
NETWORKING=yes<br />
HOSTNAME=linux.banping.com</p></blockquote>
<p>网卡参数：</p>
<blockquote><p>[root@linux ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0<br />
DEVICE=eth0<br />
BOOTPROTO=none<br />
BROADCAST=172.16.0.255<br />
HWADDR=00:50:56:82:2F:49<br />
IPADDR=172.16.0.157<br />
NETMASK=255.255.255.0<br />
NETWORK=172.16.0.0<br />
ONBOOT=yes<br />
TYPE=Ethernet<br />
USERCTL=no<br />
IPV6INIT=no<br />
PEERDNS=yes<br />
GATEWAY=172.16.0.254</p></blockquote>
<p>开机加载网卡模块：</p>
<blockquote><p>[root@linux ~]# cat /etc/modprobe.conf<br />
alias eth0 e1000<br />
alias scsi_hostadapter mptbase<br />
alias scsi_hostadapter1 mptscsi<br />
alias scsi_hostadapter2 mptspi<br />
alias scsi_hostadapter3 mptsas<br />
alias scsi_hostadapter4 mptscsih<br />
alias scsi_hostadapter5 ata_piix</p></blockquote>
<p>DNS服务器：</p>
<blockquote><p>[root@linux ~]# cat /etc/resolv.conf<br />
search banping.com<br />
nameserver 172.16.0.1<br />
nameserver 172.16.0.3<br />
nameserver 172.16.0.5</p></blockquote>
<p>IP与主机对应：</p>
<blockquote><p>[root@linux ~]# cat /etc/hosts<br />
# Do not remove the following line, or various programs<br />
# that require network functionality will fail.<br />
172.16.0.157    linux.banping.com      localhost</p></blockquote>
<p>TCP/IP协议与端口的对应</p>
<blockquote><p>[root@linux ~]# cat /etc/services</p></blockquote>
<p>重启所有网络参数：</p>
<blockquote><p>[root@linux ~]# /etc/init.d/network restart<br />
Shutting down interface eth0:  [  OK  ]<br />
Shutting down loopback interface:  [  OK  ]<br />
Setting network parameters:  [  OK  ]<br />
Bringing up loopback interface:  [  OK  ]<br />
Bringing up interface eth0:  [  OK  ]</p></blockquote>
<p>启用网卡：</p>
<blockquote><p>[root@linux ~]# ifup eth0</p></blockquote>
<p>停用网卡（慎用，否则可能导致你再也连不上了）：</p>
<blockquote><p>[root@linux ~]# ifdown eth0</p></blockquote>
<p>测试网卡：</p>
<blockquote><p>[root@linux ~]# ifconfig eth0<br />
eth0      Link encap:Ethernet  HWaddr 00:50:56:82:2F:49<br />
inet addr:172.16.0.157  Bcast:172.16.0.255  Mask:255.255.255.0<br />
inet6 addr: fe80::250:56ff:fe82:2f49/64 Scope:Link<br />
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br />
RX packets:506414 errors:0 dropped:0 overruns:0 frame:0<br />
TX packets:1691 errors:0 dropped:0 overruns:0 carrier:0<br />
collisions:0 txqueuelen:1000<br />
RX bytes:140448492 (133.9 MiB)  TX bytes:200009 (195.3 KiB)</p></blockquote>
<p>设置IP地址：</p>
<blockquote><p>[root@linux ~]# ifconfig eth0 172.16.0.157</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.banping.com/2009/11/18/linux_network_file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>关闭Linux系统不必要的程序端口</title>
		<link>http://www.banping.com/2009/11/17/close_linux_port/</link>
		<comments>http://www.banping.com/2009/11/17/close_linux_port/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 09:08:18 +0000</pubDate>
		<dc:creator>banping</dc:creator>
				<category><![CDATA[主机及存储]]></category>

		<guid isPermaLink="false">http://www.banping.com/?p=554</guid>
		<description><![CDATA[使用Linux系统，特别是放到互联网上，为了安全性考虑，需要限制一些端口，也就是关闭一些服务程序。
首先查看正在监听的有哪些连接：
[root@linux ~]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      4638/portmap
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      8769/cupsd
tcp        0      0 0.0.0.0:600                 0.0.0.0:*                   LISTEN      4658/rpc.statd
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      4878/sendmail: acce
tcp        0      0 :::22                       :::*                        LISTEN      4844/sshd
找到对应的启动程序：
[root@linux ~]# which rpc.statd
/sbin/rpc.statd
使用rmp处理：

[root@linux ~]# rpm -qf /sbin/rpc.statd
nfs-utils-1.0.6-87.EL4
[root@linux [...]]]></description>
			<content:encoded><![CDATA[<p>使用Linux系统，特别是放到互联网上，为了安全性考虑，需要限制一些端口，也就是关闭一些服务程序。</p>
<p>首先查看正在监听的有哪些连接：</p>
<blockquote><p>[root@linux ~]# netstat -tnlp<br />
Active Internet connections (only servers)<br />
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name<br />
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      4638/portmap<br />
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      8769/cupsd<br />
tcp        0      0 0.0.0.0:600                 0.0.0.0:*                   LISTEN      4658/rpc.statd<br />
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      4878/sendmail: acce<br />
tcp        0      0 :::22                       :::*                        LISTEN      4844/sshd</p></blockquote>
<p>找到对应的启动程序：</p>
<blockquote><p>[root@linux ~]# which rpc.statd<br />
/sbin/rpc.statd</p></blockquote>
<p>使用rmp处理：</p>
<blockquote><p>
[root@linux ~]# rpm -qf /sbin/rpc.statd<br />
nfs-utils-1.0.6-87.EL4</p>
<p>[root@linux ~]# ls /etc/init.d/nfs*<br />
/etc/init.d/nfs  /etc/init.d/nfslock<br />
[root@linux ~]# /etc/init.d/nfslock status<br />
rpc.statd (pid 4658) is running...<br />
[root@linux ~]# /etc/init.d/nfs status<br />
rpc.svcgssd is stopped<br />
rpc.mountd is stopped<br />
nfsd is stopped<br />
rpc.rquotad is stopped</p></blockquote>
<p>关闭该程序：</p>
<blockquote><p>[root@linux ~]# /etc/init.d/nfslock stop<br />
Stopping NFS statd: [  OK  ]</p></blockquote>
<p>这时已经看不到nfs程序了：</p>
<blockquote><p>
[root@linux ~]# netstat -tnlp<br />
Active Internet connections (only servers)<br />
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name<br />
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      4638/portmap<br />
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      8769/cupsd<br />
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      4878/sendmail: acce<br />
tcp        0      0 :::22                       :::*                        LISTEN      4844/sshd</p></blockquote>
<p>同样的办法处理internet打印的服务：</p>
<blockquote><p>[root@linux ~]# which cupsd<br />
/usr/sbin/cupsd<br />
[root@linux ~]# rpm -qf /usr/sbin/cupsd<br />
cups-1.1.22-0.rc1.9.27</p>
<p>[root@linux ~]# rpm -qc cups |grep init<br />
/etc/rc.d/init.d/cups</p>
<p>[root@linux ~]# /etc/rc.d/init.d/cups stop<br />
Stopping cups: [  OK  ]<br />
[root@linux ~]# netstat -tnlp<br />
Active Internet connections (only servers)<br />
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name<br />
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      4638/portmap<br />
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      4878/sendmail: acce<br />
tcp        0      0 :::22                       :::*                        LISTEN      4844/sshd</p></blockquote>
<p>但是现在只是关闭这些服务程序，这些程序重启后还会自动起来。</p>
<p>这时需要用Linux的chkconfig命令设置run level，将3和5这2个纯文本和X window的level关闭：</p>
<blockquote><p>[root@linux ~]# chkconfig --list|grep portmap<br />
portmap         0:off   1:off   2:off   3:on    4:on    5:on    6:off</p>
<p>[root@linux ~]# chkconfig --level 35 portmap off<br />
[root@linux ~]# chkconfig --list|grep portmap<br />
portmap         0:off   1:off   2:off   3:off   4:on    5:off   6:off</p>
<p>[root@linux ~]# chkconfig --list|grep cups<br />
cups            0:off   1:off   2:on    3:on    4:on    5:on    6:off<br />
cups-config-daemon      0:off   1:off   2:off   3:on    4:on    5:on    6:off<br />
cups-lpd:       off<br />
[root@linux ~]# chkconfig --level 235 cups off<br />
[root@linux ~]# chkconfig --list|grep cups<br />
cups            0:off   1:off   2:off   3:off   4:on    5:off   6:off<br />
cups-config-daemon      0:off   1:off   2:off   3:on    4:on    5:on    6:off<br />
cups-lpd:       off</p>
<p>[root@linux ~]# chkconfig --list|grep rpc<br />
rpcidmapd       0:off   1:off   2:off   3:on    4:on    5:on    6:off<br />
rpcgssd         0:off   1:off   2:off   3:on    4:on    5:on    6:off</p>
<p>[root@linux ~]# chkconfig --level 35 rpcidmapd off<br />
[root@linux ~]# chkconfig --level 35 rpcgssd off<br />
[root@linux ~]# chkconfig --list|grep rpc<br />
rpcidmapd       0:off   1:off   2:off   3:off   4:on    5:off   6:off<br />
rpcgssd         0:off   1:off   2:off   3:off   4:on    5:off   6:off</p>
<p>[root@linux ~]# chkconfig --list|grep sendmail<br />
sendmail        0:off   1:off   2:on    3:on    4:on    5:on    6:off<br />
[root@linux ~]# chkconfig --level 35 sendmail off<br />
[root@linux ~]# chkconfig --list|grep sendmail<br />
sendmail        0:off   1:off   2:on    3:off   4:on    5:off   6:off</p></blockquote>
<p>再重启发现只有我们想要的SSH服务了：</p>
<blockquote><p>[root@linux ~]# reboot</p>
<p>Broadcast message from root (pts/1) (Wed Nov 18 15:35:37 2009):</p>
<p>The system is going down for reboot NOW!</p>
<p>[root@linux ~]# netstat -tnlp<br />
Active Internet connections (only servers)<br />
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name<br />
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      4759/sshd</p></blockquote>
<p>但是发现现在虽然SSH可用，但日志记录了以下内容：</p>
<blockquote><p>[root@linux ~]# cat /var/log/secure</p>
<p>Nov 18 16:13:55 linux sshd[4785]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.</p></blockquote>
<p>这可能是ipv4与ipv6冲突造成的，修改配置文件即可：</p>
<blockquote><p>[root@linux ~]# vi /etc/ssh/sshd_config</p>
<p>Port 22<br />
#Protocol 2,1<br />
ListenAddress 0.0.0.0<br />
#ListenAddress ::</p></blockquote>
<p>当然，这里的ssh服务的安全性还需要进一步配置，本文不再详述。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.banping.com/2009/11/17/close_linux_port/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>把Linux登录文件保存到远程主机</title>
		<link>http://www.banping.com/2009/11/16/linux_remote_logfile/</link>
		<comments>http://www.banping.com/2009/11/16/linux_remote_logfile/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 09:07:45 +0000</pubDate>
		<dc:creator>banping</dc:creator>
				<category><![CDATA[主机及存储]]></category>

		<guid isPermaLink="false">http://www.banping.com/?p=551</guid>
		<description><![CDATA[Linux系统的syslog.conf是记录主机登录等信息的syslogd守护进程的配置文件，通过该文件可以把secure、message等登录信息传输到远程主机上，提高安全审计功能。以下是64位RedHat 4 U 7 下的配置实例。
首先配置远程主机（172.16.0.8）：
远程主机要使用udp协议514端口接收信息：
[root@erpdevdb ~]# grep 514 /etc/services
shell           514/tcp         cmd             # no passwords used
syslog          514/udp
配置可接收remote信息：
[root@erpdevdb ~]# vi /etc/sysconfig/syslog
# SYSLOGD_OPTIONS="-m 0"
SYSLOGD_OPTIONS="-m 0 -r"
重启syslogd服务：
[root@erpdevdb ~]# /etc/init.d/syslog restart
Shutting down kernel logger: [  OK  ]
Shutting down system logger: [  OK  ]
Starting system logger: [  OK  ]
Starting kernel logger: [  OK  ]
查看：
[root@erpdevdb ~]# netstat -tlunp
Active Internet connections (only servers)
udp        [...]]]></description>
			<content:encoded><![CDATA[<p>Linux系统的syslog.conf是记录主机登录等信息的syslogd守护进程的配置文件，通过该文件可以把secure、message等登录信息传输到远程主机上，提高安全审计功能。以下是64位RedHat 4 U 7 下的配置实例。</p>
<p>首先配置远程主机（172.16.0.8）：</p>
<p>远程主机要使用udp协议514端口接收信息：</p>
<blockquote><p>[root@erpdevdb ~]# grep 514 /etc/services<br />
shell           514/tcp         cmd             # no passwords used<br />
syslog          514/udp</p></blockquote>
<p>配置可接收remote信息：</p>
<blockquote><p>[root@erpdevdb ~]# vi /etc/sysconfig/syslog</p>
<p># SYSLOGD_OPTIONS="-m 0"<br />
SYSLOGD_OPTIONS="-m 0 -r"</p></blockquote>
<p>重启syslogd服务：</p>
<blockquote><p>[root@erpdevdb ~]# /etc/init.d/syslog restart<br />
Shutting down kernel logger: [  OK  ]<br />
Shutting down system logger: [  OK  ]<br />
Starting system logger: [  OK  ]<br />
Starting kernel logger: [  OK  ]</p></blockquote>
<p>查看：</p>
<blockquote><p>[root@erpdevdb ~]# netstat -tlunp<br />
Active Internet connections (only servers)</p>
<p>udp        0      0 0.0.0.0:514                 0.0.0.0:*                               5599/syslogd</p></blockquote>
<p>防火墙开放514端口：</p>
<blockquote><p>[root@erpdevdb sysconfig]# vi /etc/sysconfig/iptables</p>
<p>-A RH-Firewall-1-INPUT -p udp -m udp --dport 514 -j ACCEPT</p>
<p>[root@erpdevdb sysconfig]# service iptables restart<br />
Flushing firewall rules: [  OK  ]<br />
Setting chains to policy ACCEPT: filter [  OK  ]<br />
Unloading iptables modules: [  OK  ]<br />
Applying iptables firewall rules: [  OK  ]</p></blockquote>
<p>远程主机（172.16.0.8）要配置的就这么多，下面看要被记录的登录主机（172.16.0.15）的配置：</p>
<blockquote><p>[root@linux log]# vi /etc/syslog.conf</p>
<p># transfer log file to remote machine<br />
*.*                                                     @172.16.0.8</p></blockquote>
<p>很简单，这样就可以了。</p>
<p>下面简单测试一下，在登录主机退出并重新登录后，查看远程主机（172.16.0.8）上记录的信息:</p>
<blockquote><p>[root@erpdevdb sysconfig]# cat /var/log/secure<br />
Nov 16 11:33:46 172.16.0.15 sshd[20534]: Accepted password for root from ::ffff:172.16.0.18 port 3894</p></blockquote>
<p>可见信息已被记录到远程主机了，其他的message等信息也是如此。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.banping.com/2009/11/16/linux_remote_logfile/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>使用mksysb命令备份系统</title>
		<link>http://www.banping.com/2009/09/24/aix_mksysb/</link>
		<comments>http://www.banping.com/2009/09/24/aix_mksysb/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 05:26:13 +0000</pubDate>
		<dc:creator>banping</dc:creator>
				<category><![CDATA[主机及存储]]></category>

		<guid isPermaLink="false">http://www.banping.com/?p=497</guid>
		<description><![CDATA[使用mksysb命令可以把系统备份到磁带上，精确的说法是mksysb主要用于创建rootvg上已挂接文件系统(mounted file systems)的可引导映像(bootable image)，并可用于系统崩溃时的状态恢复。需要注意的是，这里的可引导映像不包含以下类别：
1、用户定义的页面空间(User-defined paging spaces)
2、未挂接的文件系统(unmounted file systems)
3、裸设备(raw devices)
当使用mksysb时，有时需要把一些数据文件系统排除在映像之外,可通过编辑
/etc/exclude.rootvg文件来实现，比如我要排除/tmp：
# cat /etc/exclude.rootvg
^./tmp/
然后使用-e标志来执行mksysb
# mksysb -e /dev/rmt0
Creating information file (/image.data) for rootvg.
Creating tape boot image..............
bosboot: Boot image is 29316 512 byte blocks.
Creating list of files to back up.
Backing up 2679 files.....
2679 of 2679 files (100%)
0512-038 mksysb: Backup Completed Successfully.
bosboot: Boot image is 29316 512 byte blocks.
我这里排除的文件系统如下：
ERPDB1@/home/oracle&#62;cat /etc/exclude.rootvg
^./backup_softs/
^./orasofts_bak/
^./orabak/
^./ora_arch/
备份方法：可通过smitty窗口或直接用命令行：
1，aix下可通过smitty mksysb [...]]]></description>
			<content:encoded><![CDATA[<p>使用mksysb命令可以把系统备份到磁带上，精确的说法是mksysb主要用于创建rootvg上已挂接文件系统(mounted file systems)的可引导映像(bootable image)，并可用于系统崩溃时的状态恢复。需要注意的是，这里的可引导映像不包含以下类别：</p>
<blockquote><p>1、用户定义的页面空间(User-defined paging spaces)<br />
2、未挂接的文件系统(unmounted file systems)<br />
3、裸设备(raw devices)</p></blockquote>
<p>当使用mksysb时，有时需要把一些数据文件系统排除在映像之外,可通过编辑<br />
/etc/exclude.rootvg文件来实现，比如我要排除/tmp：</p>
<blockquote><p># cat /etc/exclude.rootvg<br />
^./tmp/</p></blockquote>
<p>然后使用-e标志来执行mksysb</p>
<blockquote><p># mksysb -e /dev/rmt0<br />
Creating information file (/image.data) for rootvg.<br />
Creating tape boot image..............<br />
bosboot: Boot image is 29316 512 byte blocks.<br />
Creating list of files to back up.<br />
Backing up 2679 files.....<br />
2679 of 2679 files (100%)<br />
0512-038 mksysb: Backup Completed Successfully.<br />
bosboot: Boot image is 29316 512 byte blocks.</p></blockquote>
<p>我这里排除的文件系统如下：</p>
<blockquote><p><a>ERPDB1@/home/oracle&gt;cat</a> /etc/exclude.rootvg<br />
^./backup_softs/<br />
^./orasofts_bak/<br />
^./orabak/<br />
^./ora_arch/</p></blockquote>
<p>备份方法：可通过smitty窗口或直接用命令行：<br />
1，aix下可通过smitty mksysb -&gt; Backup Device or File 选项设置备份目标地址（可选择磁带设备或文件系统），这里也可设置其他参数：</p>
<blockquote><p><a>ERPDB1@/home/oracle&gt;smitty</a> mksysb</p>
<p>                                                         Back Up the System</p>
<p>Type or select values in entry fields.<br />
Press Enter AFTER making all desired changes.</p>
<p>                                                        [Entry Fields]<br />
    WARNING:  Execution of the mksysb command will<br />
              result in the loss of all material<br />
              previously stored on the selected<br />
              output medium. This command backs<br />
              up only rootvg volume group.</p>
<p>* Backup DEVICE or FILE                              [/dev/rmt0]<br />
  Create MAP files?                                   no<br />
  EXCLUDE files?                                      no<br />
  List files as they are backed up?                   no<br />
  Verify readability if tape device?                  no <br />
  Generate new /image.data file?                      yes<br />
  EXPAND /tmp if needed?                              no<br />
  Disable software packing of backup?                 no<br />
  Backup extended attributes?                         yes<br />
  Number of BLOCKS to write in a single output       []  <br />
     (Leave blank to use a system default)</p></blockquote>
<p>注意这里的EXCLUDE files?要设置为yes才能使上面的/etc/exclude.rootvg文件指定的排除文件生效。</p>
<p>第二种方式就是直接用命令行了，效果一样：</p>
<blockquote><p>/usr/bin/mksysb -i  -e /dev/rmt0</p></blockquote>
<p>要注意的是要选择好备份的时间，因为在备份过程中，应用程序可能会增删一些文件导致备份无法完全成功，这里记录一下碰到过的错误：</p>
<blockquote>
<div>Creating information file (/image.data) for rootvg.</div>
<div> </div>
<div>Creating tape boot image.......<br />
bosboot: Boot image is 36911 512 byte blocks.<br />
.</div>
<div> </div>
<div>Creating list of files to back up..<br />
Backing up 148474 files..............................<br />
4301 of 148474 files (2%)..............................<br />
23191 of 148474 files (15%)..............................<br />
30763 of 148474 files (20%)..............................<br />
34831 of 148474 files (23%)..............................<br />
68121 of 148474 files (45%)..............................<br />
68402 of 148474 files (46%)..............................<br />
71022 of 148474 files (47%)..............................<br />
81052 of 148474 files (54%)..............................<br />
94251 of 148474 files (63%)..............................<br />
100426 of 148474 files (67%)..............................<br />
117739 of 148474 files (79%)..............................<br />
131841 of 148474 files (88%)..............cannot access ./etc/perf/daily/xmwlm.090114: A file or directory in the path name does not<br />
 exist.<br />
.....<br />
0512-003 mksysb may not have been able to archive some files.<br />
The messages displayed on the Standard Error contained additional<br />
information.</div>
</blockquote>
<p>这是因为/etc/perf/daily/ 下的文件只保留7天，可能备到那个文件的时候正好被删除了，所以提示找不到。还碰到过这样的提示：</p>
<blockquote>
<div>78871 of 144459 files (54%).........cannot access ./u01/agent10g/sysman/emd/upload/rawdata.dat: A file or directory in the path name<br />
 does not exist.<br />
 cannot access ./u01/agent10g/sysman/emd/upload/mgmt_ha_mttr.dat: A file or directory in the path name does not exist.</div>
</blockquote>
<div> </div>
<div>后来查看：</div>
<blockquote>
<div> <a>p5b1@/#ls</a> -l /u01/agent10g/sysman/emd/upload/rawdata.dat<br />
-rw-r-----   1 oracle   oinstall      29912 Jan 22 08:35 /u01/agent10g/sysman/emd/upload/rawdata.dat<br />
<a>p5b1@/#ls</a> -l /u01/agent10g/sysman/emd/upload/mgmt_ha_mttr.dat<br />
ls: 0653-341 The file /u01/agent10g/sysman/emd/upload/mgmt_ha_mttr.dat does not exist.<br />
 </div>
</blockquote>
<div>看来有一个文件是存在的，估计是备份的时间之后才生成的。这是oracle的oem相关的动态文件，应该不影响恢复。</div>
]]></content:encoded>
			<wfw:commentRss>http://www.banping.com/2009/09/24/aix_mksysb/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>记录一些小机巡检信息</title>
		<link>http://www.banping.com/2009/09/22/ibm_p570_check/</link>
		<comments>http://www.banping.com/2009/09/22/ibm_p570_check/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 03:44:33 +0000</pubDate>
		<dc:creator>banping</dc:creator>
				<category><![CDATA[主机及存储]]></category>

		<guid isPermaLink="false">http://www.banping.com/?p=492</guid>
		<description><![CDATA[巡检内容：
p5a1@/#lsattr -El sys0
SW_dist_intr    false              Enable SW distribution of interrupts              True
autorestart     true               Automatically REBOOT system after a crash         True
boottype        disk               N/A                                               False
capacity_inc    1.00               Processor capacity increment                      False
capped          true               Partition is capped                               False
conslogin       enable             System Console Login                              False
cpuguard        enable             CPU Guard                                         True
dedicated       true               Partition is dedicated                            False
ent_capacity    7.00               Entitled processor capacity                       False
frequency       528000000          System Bus Frequency                              False
fullcore        [...]]]></description>
			<content:encoded><![CDATA[<p>巡检内容：</p>
<blockquote><p><a>p5a1@/#lsattr</a> -El sys0<br />
SW_dist_intr    false              Enable SW distribution of interrupts              True<br />
autorestart     true               Automatically REBOOT system after a crash         True<br />
boottype        disk               N/A                                               False<br />
capacity_inc    1.00               Processor capacity increment                      False<br />
capped          true               Partition is capped                               False<br />
conslogin       enable             System Console Login                              False<br />
cpuguard        enable             CPU Guard                                         True<br />
dedicated       true               Partition is dedicated                            False<br />
ent_capacity    7.00               Entitled processor capacity                       False<br />
frequency       528000000          System Bus Frequency                              False<br />
fullcore        false              Enable full CORE dump                             True<br />
fwversion       IBM,SF240_320      Firmware version and revision levels              False<br />
id_to_partition 0X800009DA2CB00001 Partition ID                                      False<br />
id_to_system    0X800009DA2CB00000 System ID                                         False<br />
iostat          false              Continuously maintain DISK I/O history            True<br />
keylock         normal             State of system keylock at boot time              False<br />
log_pg_dealloc  true               Log predictive memory page deallocation events    True<br />
max_capacity    8.00               Maximum potential processor capacity              False<br />
max_logname     9                  Maximum login name length at boot time            True<br />
maxbuf          20                 Maximum number of pages in block I/O BUFFER CACHE True<br />
maxmbuf         0                  Maximum Kbytes of real memory allowed for MBUFS   True<br />
maxpout         33                 HIGH water mark for pending write I/Os per file   True<br />
maxuproc        2048               Maximum number of PROCESSES allowed per user      True<br />
min_capacity    4.00               Minimum potential processor capacity              False<br />
minpout         24                 LOW water mark for pending write I/Os per file    True<br />
modelname       IBM,9117-570       Machine name                                      False<br />
ncargs          6                  ARG/ENV list size in 4K byte blocks               True<br />
nfs4_acl_compat secure             NFS4 ACL Compatibility Mode                       True<br />
pre430core      false              Use pre-430 style CORE dump                       True<br />
pre520tune      enable             Pre-520 tuning compatibility mode                 True<br />
realmem         41943040           Amount of usable physical memory in Kbytes        False<br />
rtasversion     1                  Open Firmware RTAS version                        False<br />
sed_config      select             Stack Execution Disable (SED) Mode                True<br />
systemid        IBM,026565FBF      Hardware system identifier                        False<br />
variable_weight 0                  Variable processor capacity weight                False</p>
<p><a>p5a1@/#uname</a> -a<br />
AIX p5a1 3 5 00C6********<br />
<a>p5a1@/#lsdev</a> -Cc adapter<br />
ent0      Available 06-08 2-Port 10/100/1000 Base-TX PCI-X Adapter (14108902)<br />
ent1      Available 06-09 2-Port 10/100/1000 Base-TX PCI-X Adapter (14108902)<br />
ent2      Available 09-08 10/100/1000 Base-TX PCI-X Adapter (14106902)<br />
ent3      Available 0C-08 10/100/1000 Base-TX PCI-X Adapter (14106902)<br />
fcs0      Available 0A-08 FC Adapter<br />
fcs1      Available 0E-08 FC Adapter<br />
ide0      Available 0D-08 ATA/IDE Controller Device<br />
lai0      Available 0G-00 GXT135P Graphics Adapter<br />
sa0       Available 08-08 IBM 8-Port EIA-232/RS-422A (PCI) Adapter<br />
sisscsia0 Available 04-08 PCI-X Ultra320 SCSI Adapter<br />
sisscsia1 Available 07-08 PCI-X Dual Channel Ultra320 SCSI Adapter<br />
sisscsia2 Available 0B-08 PCI-X Ultra320 SCSI Adapter<br />
usbhc0    Available 05-08 USB Host Controller (33103500)<br />
usbhc1    Available 05-09 USB Host Controller (33103500)<br />
vsa0      Available       LPAR Virtual Serial Adapter<br />
<a>p5a1@/#bindprocessor</a> -q<br />
The available processors are:  0 1 2 3 4 5 6 7 8 9 10 11 12 13</p>
<p><a>p5a1@/#lsattr</a> -El mem0<br />
goodsize 40960 Amount of usable physical memory in Mbytes False<br />
size     40960 Total amount of physical memory in Mbytes  False</p>
<p><a>p5a1@/#vmstat</a> 2 10</p>
<p>System configuration: lcpu=14 mem=40960MB</p>
<p>kthr    memory              page              faults        cpu<br />
----- ----------- ------------------------ ------------ -----------<br />
r  b   avm   fre  re  pi  po  fr   sr  cy  in   sy  cs us sy id wa<br />
2  0 7237693 2750115   0   0   0   0    0   0 1488 35830 3558 27  2 71  0<br />
2  0 7237814 2749990   0   0   0   0    0   0 1541 28606 3507 25  2 73  0<br />
4  0 7238386 2749413   0   0   0   0    0   0 3589 55684 9367 27  4 69  0<br />
4  0 7238425 2749370   0   0   0   0    0   0 4165 74666 10643 35  5 60  0<br />
2  0 7239861 2747930   0   0   0   0    0   0 3120 36350 7388 15  3 81  1<br />
1  0 7241937 2745849   0   0   0   0    0   0 3486 48216 9367 15  4 81  0<br />
1  0 7241932 2745850   0   0   0   0    0   0 3464 39903 9464  6  4 90  0<br />
2  0 7241924 2745854   0   0   0   0    0   0 3237 45543 9262 12  3 84  0<br />
0  0 7242286 2745487   0   0   0   0    0   0 1377 20957 4400  3  2 95  0<br />
0  0 7240801 2746968   0   0   0   0    0   0 3331 42043 9504 11  3 85  0<br />
<a>p5a1@/#lsps</a> -s<br />
Total Paging Space   Percent Used</p>
<p><a>p5a1@/#/usr/es/sbin/cluster/clstat</a> -a<br />
clstat - HACMP Cluster Status Monitor<br />
-------------------------------------</p>
<p>Cluster: xmjf   (1127707120)<br />
Tue Sep 22 09:42:00 BEIST 2009<br />
State: UP               Nodes: 2<br />
SubState: STABLE<br />
Node: p5a1              State: UP<br />
Interface: p5a1rac (0)               Address: 20.20.20.62<br />
State:   UP<br />
Resource Group: oracle                       State:  On line</p>
<p>Node: p5b1              State: UP<br />
Interface: p5b1rac (0)               Address: 20.20.20.65<br />
State:   UP<br />
Resource Group: oracle                       State:  On line</p>
<p><a>p5a1@/#instfix</a> -i |grep ML<br />
All filesets for 5.3.0.0_AIX_ML were found.<br />
All filesets for 5300-01_AIX_ML were found.<br />
All filesets for 5300-02_AIX_ML were found.<br />
All filesets for 5300-03_AIX_ML were found.<br />
All filesets for 5300-04_AIX_ML were found.<br />
All filesets for 5300-05_AIX_ML were found.<br />
All filesets for 5300-06_AIX_ML were found.</p>
<p># sar -P ALL 2 10</p>
<p>AIX p55a 3 5 000221F3D600    05/13/10</p>
<p>System configuration: lcpu=16  mode=Capped</p>
<p>10:20:16 cpu    %usr    %sys    %wio   %idle   physc<br />
10:20:18  0        0       1       0      99    0.56<br />
1        0       1       0      99    0.44<br />
2        0       4       0      95    0.54<br />
3        0       1       0      99    0.46<br />
4        0       1       0      99    0.54<br />
5        0       1       0      99    0.47<br />
6        0       4       0      96    0.53<br />
7        0       1       0      99    0.46<br />
8        0       1       0      99    0.54<br />
9        0       1       0      99    0.47<br />
10        0       1       0      99    0.53<br />
11        0       1       0      99    0.47<br />
12        0       2       0      98    0.54<br />
13        0       1       0      99    0.46<br />
14        0       5       0      95    0.55<br />
15        0       1       0      99    0.45<br />
-        0       2       0      98    8.00<br />
10:20:20  0        0       2       0      98    0.56<br />
1        0       1       0      99    0.44<br />
2        0       4       0      96    0.54<br />
3        0       1       0      99    0.46<br />
4        0       1       0      99    0.53<br />
5        0       1       0      99    0.47<br />
6        0       4       0      96    0.54<br />
7        0       1       0      99    0.46<br />
8        0       1       0      99    0.53<br />
9        0       1       0      99    0.47<br />
10        0       1       0      99    0.53<br />
11        0       1       0      99    0.47<br />
12        0       1       0      99    0.54<br />
13        0       1       0      99    0.46<br />
14        0       5       0      94    0.56<br />
15        0       1       0      99    0.44<br />
-        0       2       0      98    8.00<br />
10:20:22  0        0       1       0      99    0.56<br />
1        0       1       0      99    0.44<br />
2        0       5       0      95    0.54<br />
3        0       1       0      99    0.46<br />
4        0       1       0      99    0.54<br />
5        0       1       0      99    0.47<br />
6        0       4       0      96    0.54<br />
7        0       1       0      99    0.46<br />
8        0       1       0      99    0.53<br />
9        0       1       0      99    0.47<br />
10        0       1       0      99    0.54<br />
11        0       1       0      99    0.47<br />
12        0       2       0      98    0.52<br />
13        0       1       0      99    0.46<br />
14        0       4       0      96    0.55<br />
15        0       1       0      99    0.45<br />
-        0       2       0      98    7.99</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.banping.com/2009/09/22/ibm_p570_check/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
