幸好他的adsl用户名就是电话号码,我打了电话过去,告诉他路由器很不安全,那人连声谢谢都没说,真扫兴。
2003年创造利润过亿,声称2年后每天缴税100万,3月份融进8200万美刀……一系列数字表明,马云和阿里巴巴俨然已经成为B2B的楷模。而同时,笼罩在这两个精明商人身上的谜团也越来越多。一方面马云声称阿里巴巴大把大把钱花不出去,同时却又融资8200万,上市前夜稀释股权令人不解;而各路媒体对阿里巴巴有关数据报道不一,有的称其2003底实现日收入100万元,有的称其2003年平均日收入100万元,诸如此类让人摸不着头脑。我对阿里巴巴的关注也是从数据疑云开始的。当然,灌耳大名是早就听说了,但是我起初就对阿里巴巴的模式没什么信心,所以也没怎么关注,这个网站发展到今天,我想也几乎走到死胡同了。总结了五大看点,足以令阿里巴巴噎死,与大家共赏:
看点一:大企业不会参与这个游戏。
大企业会选择建立自己的信息发布平台和供应链系统,并且大企业多有固定的供应商和信息渠道。马云也说:“我们的套路是以小企业为主……全世界有钱的人没有多少,从数量上讲大企业最多占到企业总数的10% 左右。”虽然只有10%,但是这10%的能量如何巨大也不用我多说。况且随着经济一体化和信息技术的发展,跨国巨头不断将收购和兼并的企业纳入自己全球化的统一购销管理中。阿里巴巴能插足的地方越来越少,到时候恐怕只能是个丐帮帮主。大家可以想像,如果GE在上面发布了一条1亿美元的采购信息,会给GE带来多少麻烦,但是这里面又有几个能真正符合要求的供货商呢?
看点二:任何有能力的企业,都倾向于建立自己的信息发布平台。
大企业不参与这个游戏,不会影响阿里的盈利信心,毕竟全国全球的小企业也那么多嘛!但是阿里到底能拉拢多少忠实的小企业呢?信息流的重要性已经为各界企业所一致认同,没有任何企业甘心让第三方商人把持自己的信息平台,这是极其危险的,也满足不了企业发展的需求。有能力的中小企业大多会选择将平台开发外包给第三方,或是直接购买,总之一定要有自己的平台。典型的例子就是企业网站,基于这一点,也可以推断,网上的所有自助建站服务都难以有长期忠实客户。分散信息平台+搜索引擎,将来就是集中信息平台的替代品。况且,小企业总是要壮大的,等小企业做成了大企业,与阿里巴巴的蜜月也就结束了。事实上,不难推测,在中国这种国情下,阿里巴巴公司库里面80%的企业都是处于严重弱势的小企业。也许里面有的是黑马,但阿里巴巴有什么樊篱能圈住它呢?
看点三:Google这类技术起家的搜索引擎企业的崛起,对阿里巴巴将是致命打击。(超重量看点,直接攻击阿里巴巴模式)
在互联网业发家有很多种方式,Google是靠技术,盛大是靠经营,3721是靠创意……阿里巴巴靠的是……销售?还是炒作?不管阿里巴巴底层是什么技术,但是在应用和外观上与它相同的程序已经在网上泛滥了,2分钟就能搭建一个与阿里巴巴类似的站点。马云说,“阿里巴巴之所以扬名国际,诀窍无他,一是没钱,二不懂技术!”,“不关心技术,关心的是技术有多简单”,“不懂技术,才与客户更接近”,“我可以用,百分之八十的客户也可以用”。
此番话有一定道理,虽然技术精英不一定都能赚大钱,但是赚大钱的几位IT首富却都是技术出身。现在Google的两位技术天才努力在向人们展示,通过搜索引擎优化,分散的信息能够瞬间变得条理有序。虽然现在还做不到,但是也许很快,企业通过搜索引擎,便能轻而易举地抓到自己需要的供求信息,其方便、廉价、信息无界,将从根本上颠覆事先将信息汇聚到一处再进行查找的信息搜索模式。整个世界变成了一个超有机体,根本不需要有任何诸如“中心”、“最大”此类的概念。如果从单纯的信息供求角度讲,阿里巴巴必将被搜索引擎取代。好在企业的商业活动并不只在简单的供求,阿里巴巴必须大力强调并解决搜索引擎所不能解决的问题。用商人社区来加强商业沟通,用诚信通来解决诚信问题,都是阿里巴巴重要的棋子。马云似乎很鄙视Amazon这类的B
看点四:解读阿里巴巴的核心竞争力,人气对阿里巴巴的作用几何?
互联网企业大者通吃,人气是大多数互联网企业的核心竞争力之一,阿里巴巴也不例外。但是人气是怎么来的?攫取人气的方法和手段,才是一个互联网企业最大的核心竞争力。
所谓人生人,只要模式正确,人气聚集到一定阶段将迸发出巨大的自我成长力,比如腾讯QQ,比如边锋游戏,用户呈几何数量级增长并不是由巨大的广告或销售投入带来的,很多用户就像被磁石吸引一样,是自动自愿加入的,是已有的人气带来的。互联网企业做到这份上,算是修成正果了,这时候的人气才配称为核心竞争力。
反观阿里巴巴呢?阿里巴巴如狼似虎的销售人员,早已为人熟知。我真想知道马云是怎么训练他们的,比起保险推销都有过之而无不及。对于阿里的激励机制不甚了解,不过猜测定是充满了高提成、洗脑、魔鬼训练一类的东东。这绝非一个互联网企业应有的特征。通过几乎强迫式销售,确实很多企业加入了阿里巴巴。我只能说这种做法不顾死活,对人气长久的聚集,对树立口碑——人气生人气,实在没什么好处,帝国倒塌只在旦夕之间。
姑且把销售作为一个核心竞争力吧,另外一个核心竞争力就是做秀了。马云在中央台的上镜率极高,频频参加各个论坛、讨论、商会,不遗余力炒作“网商”概念,操持各类展会大做文章,炒作淘宝……有个细节不知道大家注意了没有:阿里巴巴曾在央视2台热播的绝对挑战上进行职位招聘。事后回访马云,马云说:“其实一开始我觉得这种招聘找不到什么才人,但是现在这位***(人名已经忘记了)各方面才能都得到了同事和领导的认可……”大意就是如此,明知招不到好人才却还要来个“壮士断腕”,做秀之心昭然若揭。另外就是企业的各类数据,阿里巴巴不是上市公司,财务数据保密,98%的数据信息都从马云口中传出,数据谜团,我看是解不了啦。
此两者做核心竞争力,我怎么觉得阿里巴巴还不如安利呢?
看点五:客户企业到底从阿里巴巴得到了什么?
注册资本10万的企业,被要价4-10万/年;一年做不了一笔正当生意,还差点被骗;发布的信息找不到在哪里显示……此类重大问题,很多朋友对我提起。而且在阿里巴巴的客服论坛里,一大堆问题得不到回复。阿里巴巴的服务做成什么了?
访问阿里巴巴的网站,首先就让你申请诚信通,网站好不好用还不知道,就先赚你1200。天哪,总得先看后试,再决定买不买吧?真正的电子商务平台,不是事先收钱 ,是企业和企业间成交后。收取一定的佣金。阿里啊,你是B2B还是婚姻介绍所啊。
婚姻介绍所要是提供了虚假信息还得负责任呢,你的客户受骗你又做了什么呢?
产品销售了,升级了,改版了,总得给指导一下吧,但是你那些业务员只想着完成销售。
你的产品和服务质量有个保证吗,到底能在多大程度上促进客户的成交?客户想退货想投诉都找不到理由啊。
阿里,你到底有多少客户成交?根据你的广告,300万人10亿元的成交额,每人只有333元吗?可是一个诚信通就收上千元哪
阿里巴巴,你是四十大盗吧?
其他看点?
马云和阿里巴巴真的一无是处了?当然不是,但已经钻进了死胡同,这是这个模式的必然。眼光敏锐的马云,可能几年前就意识到了。不过这都无所谓了,据说马云现在仅占阿里巴巴5%的股份,阿里巴巴会渐渐淡出马云的视野。马云依靠阿里巴巴塑造了个人魅力,阿里积累了巨量知名度和可观的人气,在网络商业诚信的解决方案上迈出了重要一步(这大概是阿里现在最宝贵的资源),商人社区也搞得生龙活虎(但就发言者的语气来看,枪手众多!),开始着手开发自有技术的搜索引擎(好像已经晚了)……最重要的是虽然没有上市,但获得了风险投资的追捧,有了这些Money,马云可以翻云覆雨踏入别的领域,阿里巴巴可以堂而皇之地苟延数年……现在的阿里巴巴,后有搜索引擎、行业门户这些追兵,但是前面没有堵截啊~~风险投资对他敞开大门,所以日子还是蛮甜的。
Hot rain forest 说:
就剩下我一个了
Hot rain forest 说:
修斯 说:
哈哈
zeng 说:
怎么了
zeng 说:
孙亘干吗去了
修斯 说:
信国要去考
修斯 说:
研究生?
修斯 说:
我?
zeng 说:
为了理想了,
Hot rain forest 说:
他也不再ce了
Hot rain forest 说:
自己干去了
修斯 说:
我7月就出来了
zeng 说:
资本运作一直是我的追求,辞职表示彻底走这条路
修斯 说:
祝福你!!!
修斯 说:
那你考经济学?
Hot rain forest 说:
become a boss is good idea
zeng 说:
金融工程
修斯 说:
什么学校的?
zeng 说:
经济学 的 金融工程
zeng 说:
中央财大
修斯 说:
不错不错
修斯 说:
鼎立支持!
Hot rain forest 说:
时间太紧了
Hot rain forest 说:
7,8月走,就来的急了
修斯 说:
我相信信国能创造奇迹~~
修斯 说:
信国 不用担心,放马创吧!
Hot rain forest 说:
呵呵,考研究生可不容易
zeng 说:
是的,我这样做决定,就意味着了
修斯 说:
什么时候离开CE?
zeng 说:
多谢提醒,领海
zeng 说:
应该今天就能办完手续
修斯 说:
不错
修斯 说:
将要离开4年的CE了~~~~
zeng 说:
呵呵,今天不离开,我将一辈子提个包上班,这痛苦
Hot rain forest 说:
离开实早晚的
Hot rain forest 说:
包==笔记本呀!!!
Hot rain forest 说:
修斯 说:
哎 搞金融的也提包 哈哈
Hot rain forest 说:
呵呵
修斯 说:
什么时候考试?
zeng 说:
以后牛B了,让保镖提啊
Hot rain forest 说:
1月
zeng 说:
是的1月22、23日
Hot rain forest 说:
不是保镖,是mm
修斯 说:
金融工程都学什么?
Tomcat全攻略
内容:
一:简介
二:安装及配置
三:应用
四:综述
随着java的流行,其在web上的应用也越来越广,tomcat作为一个开源的servlet容器,应用前景越来越广,本文将向你讲述tomcat的一些知识。
一:简介
tomcat是jakarta项目中的一个重要的子项目,其被JavaWorld杂志的编辑选为2001年度最具创新的java产品(Most Innovative Java Product),同时它又是sun公司官方推荐的servlet和jsp容器(具体可以见http://java.sun.com/products/jsp/tomcat/),因此其越来越多的受到软件公司和开发人员的喜爱。servlet和jsp的最新规范都可以在tomcat的新版本中得到实现。
二:安装及配置
tomcat最新版本为4.0.1,这个版本用了一个新的servlet容器Catalina,完整的实现了servlet2.3和jsp1.2规范。注意安装之前你的系统必须安装了jdk1.2以上版本。
(一):安装
1:windows平台
从tomcat网站下载jakarta-tomcat-4.0.1.exe,按照一般的windows程序安装步骤即可安装好tomcat,安装时它会自动寻找你的jdk和jre的位置。
2:linux平台
下载jakarta-tomcat-4.0.1.tar.gz,将其解压到一个目录。
(二):配置
运行tomcat需要设置JAVA_HOME变量
set JAVA_HOME=c:/jdk (win98,在msdos方式下使用,或者放入autoexec.bat中)
export JAVA_HOME=/usr/local/jdk (linux下使用,放到/etc/bashrc或者/etc/profile中)
(三):运行
设置完毕后就可以运行tomcat服务器了,进入tomcat的bin目录,win98下用startup启动tomcat,linux下用startup.sh,相应的关闭tomcat的命令为shutdown和shutdown.sh。
启动后可以在浏览器中输入http://localhost:8080/测试,由于tomcat本身具有web服务器的功能,因此我们不必安装apache,当然其也可以与apache集成到一起,下面会介绍。
下面你可以测试其自带的jsp和servlet示例。
三:应用
(一):目录结构
tomcat的目录结构如下: 目录名 简介
bin 存放启动和关闭tomcat脚本
conf 包含不同的配置文件,server.xml(Tomcat的主要配置文件)和web.xml
work 存放jsp编译后产生的class文件
webapp 存放应用程序示例,以后你要部署的应用程序也要放到此目录
logs 存放日志文件
lib/japser/common 这三个目录主要存放tomcat所需的jar文件
(二):server.xml配置简介
下面我们将讲述这个文件中的基本配置信息,更具体的配置信息见tomcat的文档 元素名 属性 解释
server port 指定一个端口,这个端口负责监听关闭tomcat的请求
shutdown 指定向端口发送的命令字符串
service name 指定service的名字
Connector
(表示客户端和service之间的连接) port 指定服务器端要创建的端口号,并在这个断口监听来自客户端的请求
minProcessors 服务器启动时创建的处理请求的线程数
maxProcessors 最大可以创建的处理请求的线程数
enableLookups 如果为true,则可以通过调用request.getRemoteHost()进行DNS查询来得到远程客户端的实际主机名,若为false则不进行DNS查询,而是返回其ip地址
redirectPort 指定服务器正在处理http请求时收到了一个SSL传输请求后重定向的端口号
acceptCount 指定当所有可以使用的处理请求的线程数都被使用时,可以放到处理队列中的请求数,超过这个数的请求将不予处理
connectionTimeout 指定超时的时间数(以毫秒为单位)
Engine
(表示指定service中的请求处理机,接收和处理来自Connector的请求) defaultHost 指定缺省的处理请求的主机名,它至少与其中的一个host元素的name属性值是一样的
Context
(表示一个web应用程序,通常为WAR文件,关于WAR的具体信息见servlet规范) docBase 应用程序的路径或者是WAR文件存放的路径
path 表示此web应用程序的url的前缀,这样请求的url为http://localhost:8080/path/****
reloadable 这个属性非常重要,如果为true,则tomcat会自动检测应用程序的/WEB-INF/lib 和/WEB-INF/classes目录的变化,自动装载新的应用程序,我们可以在不重起tomcat的情况下改变应用程序
host
(表示一个虚拟主机)
name 指定主机名
appBase 应用程序基本目录,即存放应用程序的目录
unpackWARs 如果为true,则tomcat会自动将WAR文件解压,否则不解压,直接从WAR文件中运行应用程序
Logger
(表示日志,调试和错误信息)
className 指定logger使用的类名,此类必须实现org.apache.catalina.Logger 接口
prefix 指定log文件的前缀
suffix 指定log文件的后缀
timestamp 如果为true,则log文件名中要加入时间,如下例:localhost_log.2001-10-04.txt
Realm
(表示存放用户名,密码及role的数据库)
className 指定Realm使用的类名,此类必须实现org.apache.catalina.Realm接口
Valve
(功能与Logger差不多,其prefix和suffix属性解释和Logger 中的一样)
className 指定Valve使用的类名,如用org.apache.catalina.valves.AccessLogValve类可以记录应用程序的访问信息
directory 指定log文件存放的位置
pattern 有两个值,common方式记录远程主机名或ip地址,用户名,日期,第一行请求的字符串,HTTP响应代码,发送的字节数。combined方式比common方式记录的值更多
注意:1:经过我测试,我设置Context 的path=”",reloadable=true,然后放一个WAR文件到webapps目录,结果tomcat不能检测出此文件(重起tomcat可以),而把此文件解压,则tomcat会自动检测出这个新的应用程序。如果不能自动检测WAR文件,我们可以利用下面管理中讲的方法来部署应用程序。
2:默认的server.xml中,Realm元素只设置了一个className属性,但此文件中也包含几个通过JDBC连接到数据库进行验证的示例(被注释掉了),通过Realm元素我们可以实现容器安全管理(Container Managed Security)。
3:还有一些元素我们没有介绍,如Parameter,loader,你可以通过tomcat的文档获取这些元素的信息。
(三):管理
1:配置
在进行具体的管理之前,我们先给tomcat添加一个用户,使这个用户有权限来进行管理。
打开conf目录下的tomcat-users.xml文件,在相应的位置添加下面一行:
注意:这一行的最后部分一定是/>,tomcat的文档掉了/符号,如果没有/符号的话,tomcat重起时将无法访问应用程序。通过logs/catalina.out文件你可以看到这个错误的详细信息。
然后重起tomcat,在浏览器中输入http://localhost:8080/manager/,会弹出对话框,输入上面的用户名和密码即可。
2:应用程序列表
在浏览器中输入http://localhost:8080/manager/list,浏览器将会显示如下的信息:
OK – Listed applications for virtual host localhost
/ex:running:1
/examples:running:1
/webdav:running:0
/tomcat-docs:running:0
/manager:running:0
/:running:0
面的信息分别为应用程序的路径,当前状态(running 或者stopped),与这个程序相连的session数。
3:重新装载应用程序
在浏览器中输入 localhost:8080/manager/reload?path=/examples,浏览器显示如下:
OK – Reloaded application at context path /examples
表示example应用程序装载成功,如果我们将server.xml的Context元素的reloadable属性设为true(见上面表格),则没必要利用这种方式重新装载应用程序,因为tomcat会自动装载。
4:显示session信息
在浏览器中输入http://localhost:8080/manager/sessions?path=/examples,浏览器显示如下: OK – Session information for application at context path /examples Default maximum session inactive interval 30 minutes
5:启动和关闭应用程序
在浏览器中输入http://localhost:8080/manager/start?path=/examples和http://localhost:8080/manager/stop?path=/examples分别启动和关闭examples应用程序。
6:部署及撤销部署
WAR有两种组织方式,一种是按一定的目录结构组织文件,一种是一个后缀为WAR的压缩包,因此它的部署方式也有两种:
(1):在浏览器中输入:http://localhost:8080/manager/install?path=/examples&war=file:/c:\examples
就会将按目录结构组织的WAR部署
(2):如果输入:http://localhost:8080/manager/install?path=/examples&war=jar:file:/c:\examples.war!/
就会将按压缩包组织的WAR部署,注意此url后半部分一定要有!/号。
部署后就可以用 localhost:8080/examples访问了。
在浏览器中输入:http://localhost:8080/manager/remove?path=/examples
就会撤销刚才部署的应用程序。
(四):与apache集成
虽然tomcat也可以作web服务器,但其处理静态html的速度比不上apache,且其作为web服务器的功能远不如apache,因此我们想把apache和tomcat集成起来。
我们以linux系统为例介绍.
从apache网站下载apache1.3.22源代码版本,然后使用如下命令配置安装apache:
mkdir /usr/local/apache
tar zxvf apache.1.32.tar.gz
cd apache.1.32
./configure –prefix=/usr/local/apache –enable-module=so
make
make install
注意configure命令指定目标安装目录,并且加入DSO(Dynamic Shared Object)支持,注意一定不要忘了这一个选项。
然后下载webapp模块,将解压后mod_webapp.so文件放入apache的libexec目录,编辑apache的conf目录下的httpd.conf,在这个文件的最后加入下面三行:
LoadModule webapp_module libexec/mod_webapp.so
WebAppConnection warpConnection warp localhost:8008
WebAppDeploy examples warpConnection /examples/
第一行是加入webapp模块,如果编译apache时不增加DSO支持,则无法使用LoadModule指令,第二行指定tomcat与apache的连接,第三行指定部署那个应用,这两个指令使用格式如下:
WebAppConnection [connection name] [provider] [host
ort]
WebAppDeploy [application name] [connection name] [url path]
其中connection name指定连接名,provider只能是warp,port端口与你的tomcat的配置文件server.xml最后几行指定的要保持一致。文件如下:
enableLookups=”true”
acceptCount=”10″ debug=”0″/>
******
application name与你在tomcat中部署的应用名一致,url path指定访问这个应用的url。例如上面的例子可以通过http://localhost/examples/来访问tomcat中的examples应用。
(五):中文问题
一般jsp的乱码问题可以通过在jsp中加入<%@ page contentType="text/html;charset=GB2312" %>来解决,至于servlet的乱码在可以使用servlet2.3中提供的HttpServeletRequest.setCharacterEncoding函数。更详细的中文问题请见JSP/Servlet 中的汉字编码问题。
四:综述
tomcat作为一个servlet(jsp也被编译为servlet执行)容器,其应用前景是非常好的,如果与jboss结合起来,则可以实现sun的j2ee规范(用jboss作ejb服务器)。jboss的官方网站也提供集成了tomcat3.2*的jboss以供下载。另外一个开源的应用服务器(enhydra) 也是基于tomcat的,其提供了更友好的管理界面,部署应用程序也更简单,功能也更强大。
参考资料:
tomcat文档
www.jguru.com/faq/Tomcat
In This Chapter
How To Configure Your NIC’s IP Address
How To Activate / Shutdown Your NIC
How To Change Your Default Gateway
How To View Your Current Routing Table
How To Change The Duplex Setting Of Your NIC
How To Convert Your Linux Server Into A Router
Configuring Your /etc/hosts File
(c) Peter Harrison, www.linuxhomenetworking.com
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
This chapter covers how to configure your Linux box’s networking features.
How To Configure Your NIC’s IP Address
Determining Your IP Address
Most modern PCs come with an ethernet port. When Linux is installed, this device is called “eth0“. You can determine the IP address of this device with the “ifconfig” command.
[root@bigboy tmp]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:08:C7:10:74:A8
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:11 Base address:0×1820
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:787 errors:0 dropped:0 overruns:0 frame:0
TX packets:787 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:82644 (80.7 Kb) TX bytes:82644 (80.7 Kb)
wlan0 Link encap:Ethernet HWaddr 00:06:25:09:6A:B5
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:47379 errors:0 dropped:0 overruns:0 frame:0
TX packets:107900 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:4676853 (4.4 Mb) TX bytes:43209032 (41.2 Mb)
Interrupt:11 Memory:c887a000-c887b000
wlan0:0 Link encap:Ethernet HWaddr 00:06:25:09:6A:B5
inet addr:192.168.1.99 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:11 Memory:c887a000-c887b000
[root@bigboy tmp]#
In this example, eth0 has no IP address as this box is using wireless interface wlan0 as it’s main NIC. Interface wlan0 has an IP address of 192.168.1.100 and a subnet mask of 255.255.255.0
You can see that this command gives good information on the interrupts used by each card. This can also be found in less detail in the file /proc/interrupts
Changing Your IP Address
If you wanted, you could give this eth0 interface an IP address using the ifconfig command.
[root@bigboy tmp]# ifconfig eth0 10.0.0.1 netmask 255.255.255.0 up
The “up” at the end of the command activates the interface. To make this permanent each time you boot up you’ll have to add this command in your /etc/rc.d/rc.local file.
Linux also makes life a little easier with interface configuration files located in the /etc/sysconfig/network-scripts directory. Interface eth0 has a file called ifcfg-eth0, eth1 uses ifcfg-eth1 … etc. You can place your IP address information in these files which are then used to auto-configure your NICs when Linux boots. Here are two samples for interface eth0, one assumes the interface has a fixed IP address, the other assumes it requires an IP address assignment using DHCP.
network-scripts File Formats
|
Fixed IP Address |
|
[root@bigboy tmp]# cd /etc/sysconfig/network-scripts [root@bigboy network-scripts]# more ifcfg-eth0
# # The following settings are optional # BROADCAST=192.168.1.255 [root@bigboy network-scripts]#
|
|
Getting the IP Address using DHCP |
|
[root@bigboy tmp]# cd /etc/sysconfig/network-scripts [root@bigboy network-scripts]# more ifcfg-eth0
|
As you can see eth0 will be activated on booting as the parameter ONBOOT has the value “yes” and not “no”. You can read more about netmasks and DHCP on the introduction to networking chapter.
The default RedHat/Fedora installation will include the “broadcast” and “network” options in the network-scripts file. These are usually optional.
Once you change the values in the configuration files for the NIC you’ll have to deactivate and activate it for the modifications to take effect. The ifdown and ifup commands can be used to do this.
[root@bigboy network-scripts]# ifdown eth0
[root@bigboy network-scripts]# ifup eth0
How DHCP Affects The DNS Server You Use
Your DHCP server not only supplies the IP address your Linux box should use, but also the desired DNS servers. Make sure your /etc/resolv.conf file has the “servers” configuration lines commented out to prevent any conflicts.
Multiple IP Addresses On A Single NIC
In the previous “determining your IP address” section you may have noticed that there were two wireless interfaces. One’s named wlan0 and the other wlan0:0. Interface wlan0:0 is actually a “child” of interface wlan0, a virtual sub-interface also known as an “IP alias”. IP aliasing is one of the most common ways of creating multiple IP addresses associated with a single NIC. Aliases have the name format “parent-interface-name:X“, where “X” is the sub-interface number of your choice.
The process for creating an IP alias is very similar to the steps outlined for the real interface in the previous “changing your IP address” section. The example below is for the wlan0:0 sub-interface.
o First ensure the “parent” real interface exists
o Verify that no other IP aliases with the same name exists with the name you plan to use. In this we want to create interface wlan0:0
o Create the virtual interface with the ifconfig command
[root@bigboy tmp]# ifconfig wlan0:0 192.168.1.99 \
netmask 255.255.255.0 up
o You should also create a /etc/sysconfig/network-scripts/ifcfg-wlan0:0 file so that the aliases will all be managed automatically with the ifup and ifdown commands. Here is a sample:
DEVICE=wlan0:0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.99
NETMASK=255.255.255.0
IP Address Assignment For A Direct DSL Connection
If you are using a DSL connection with fixed or “static” IP addresses, then the configuration steps are the same as those outlined above. You plug your ethernet interface into the DSL modem, configure it with the IP address, subnet mask, broadcast address and gateway information provided by your ISP and you should have connectivity once you restart your interface. Remember that you may also need to configure your DNS server correctly.
If you are using a DSL connection with a DHCP or “dynamic” IP address assignment, then the process is different. Your ISP will provide you with a PPPoE “username” and “password” which will allow your computer to login transparently to the Internet each time it boots up. Fedora Linux installs the rp-pppoe RPM software package required to support this.
Downloading and installing RPMs isn’t hard. If you need a refresher, the chapter on RPMs covers how to do this in detail. When searching for the file, remember that the PPPoE RPM’s filename usually starts with the word “rp-pppoe” followed by a version number like this: rp-pppoe-3.5-8.i386.rpm.
After installing the RPM, you’ll need to go through a number of steps to complete the connection. The PPPOE configuration will create a software based virtual interface named ppp0 that will use the physical Internet interface eth0 for connectivity. Here’s what you need to do:
o Make a backup copy of your ifcfg-eth0 file.
[root@bigboy tmp]#
[root@bigboy tmp]# cd /etc/sysconfig/network-scripts/
[root@bigboy network-scripts]# ls ifcfg-eth0
ifcfg-eth0
[root@bigboy network-scripts]# cp ifcfg-eth0 DISABLED.ifcfg-eth0
o Edit your ifcfg-eth0 file to have no IP information and also to be deactivated on boot time.
DEVICE=eth0
ONBOOT=no
o Shutdown your eth0 interface.
[root@bigboy network-scripts]# ifdown eth0
[root@bigboy network-scripts]#
o Run the adsl-setup configuration script
[root@bigboy network-scripts]# adsl-setup
o It will prompt you for your ISP username, the interface to be used (eth0) and whether you want to the connection to stay up indefinitely. We’ll use defaults wherever possible.
Welcome to the ADSL client setup. First, I will run some checks on
your system to make sure the PPPoE client is installed properly…
LOGIN NAME
Enter your Login Name (default root): bigboy-login@isp
INTERFACE
Enter the Ethernet interface connected to the ADSL modem
For Solaris, this is likely to be something like /dev/hme0.
For Linux, it will be ethX, where ‘X’ is a number.
(default eth0):
Do you want the link to come up on demand, or stay up continuously?
If you want it to come up on demand, enter the idle time in seconds
after which the link should be dropped. If you want the link to
stay up permanently, enter ‘no’ (two letters, lower-case.)
NOTE: Demand-activated links do not interact well with dynamic IP
addresses. You may have some problems with demand-activated links.
Enter the demand value (default no):
o It will then prompt you for your DNS server information. This step will edit your /etc/resolv.conf file. If you’re running BIND on your server in a caching DNS mode then you may want to leave this option blank. If you want your ISP to automatically provide the IP address of its DNS server then enter the word “server”.
DNS
Please enter the IP address of your ISP’s primary DNS server.
If your ISP claims that ‘the server will provide dynamic DNS addresses’, enter ’server’ (all lower-case) here.
If you just press enter, I will assume you know what you are
doing and not modify your DNS setup.
Enter the DNS information here:
o The script will then prompt you for your ISP password
PASSWORD
Please enter your Password:
Please re-enter your Password:
o Then it will ask whether you want regular users (not superuser “root“) to be able to activate/deactivate the new ppp0 interface. This may be required if non “root” members of your family or home office need to get access to the Internet.
USERCTRL
Please enter ‘yes’ (two letters, lower-case.) if you want to allow
normal user to start or stop DSL connection (default yes):
o The rp-pppoe package has two sample ipchains firewall scripts located in the /etc/ppp directory named firewall-standalone and firewall-masq. They are very basic and don’t cover rules to make your Linux box a web server, DNS server nor mail server. I’d recommend selecting “none” and using a variant of the basic script samples in the firewall chapter, or the more comprehensive one found in the Appendix.
FIREWALLING
Please choose the firewall rules to use. Note that these rules are
very basic. You are strongly encouraged to use a more sophisticated
firewall setup; however, these will provide basic security. If you
are running any servers on your machine, you must choose ‘NONE’ and
set up firewalling yourself. Otherwise, the firewall rules will deny
access to all standard servers like Web, e-mail, ftp, etc. If you
are using SSH, the rules will block outgoing SSH connections which
allocate a privileged source port.
The firewall choices are:
0 – NONE: This script will not set any firewall rules. You are responsible
for ensuring the security of your machine. You are STRONGLY
recommended to use some kind of firewall rules.
1 – STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
2 – MASQUERADE: Appropriate for a machine acting as an Internet gateway
for a LAN
Choose a type of firewall (0-2): 0
o You’ll then be asked whether you want the connection to be activated upon booting. Most people would say “yes”.
Start this connection at boot time
Do you want to start this connection at boot time?
Please enter no or yes (default no):yes
o Just before exiting, you’ll get a summary of the parameters you entered and the relevant configuration files will be updated to reflect your choices when you accept them.
** Summary of what you entered **
Ethernet Interface: eth0
User name: bigboy-login@isp
Activate-on-demand: No
DNS: Do not adjust
Firewalling: NONE
User Control: yes
Accept these settings and adjust configuration files (y/n)? y
Adjusting /etc/sysconfig/network-scripts/ifcfg-ppp0
Adjusting /etc/ppp/chap-secrets and /etc/ppp/pap-secrets
(But first backing it up to /etc/ppp/chap-secrets.bak)
(But first backing it up to /etc/ppp/pap-secrets.bak)
o At the very end it will tell you the commands to use to activate /deactivate your new ppp0 interface and to get a status of the interface’s condition.
Congratulations, it should be all set up!
Type ‘/sbin/ifup ppp0′ to bring up your xDSL link and ‘/sbin/ifdown ppp0′to bring it down.
Type ‘/sbin/adsl-status /etc/sysconfig/network-scripts/ifcfg-ppp0′
to see the link status.
The above example recommends using the adsl-status command with the name of the PPPoE interface configuration file. This command defaults to show information for interface ppp0 and therefore listing the ifcfg-ppp0 filename won’t be necessary in most home enviornments.
Some Important Files Created By adsl-setup
The adsl-setup script creates three files that will be of interest to you. The first is the ifcfg-ppp0 file with interface’s link layer connection parameters
[root@bigboy network-scripts]# more ifcfg-ppp0
USERCTL=yes
BOOTPROTO=dialup
NAME=DSLppp0
DEVICE=ppp0
TYPE=xDSL
ONBOOT=yes
PIDFILE=/var/run/pppoe-adsl.pid
FIREWALL=NONE
PING=.
PPPOE_TIMEOUT=20
LCP_FAILURE=3
LCP_INTERVAL=80
CLAMPMSS=1412
CONNECT_POLL=6
CONNECT_TIMEOUT=60
DEFROUTE=yes
SYNCHRONOUS=no
ETH=eth0
PROVIDER=DSLppp0
USER= bigboy-login@isp
PEERDNS=no
[root@bigboy network-scripts]#
> The others are the duplicate /etc/ppp/pap-secrets and /etc/ppp/chap-secrets files with the username and password needed to login to your ISP.
[root@bigboy network-scripts]# more /etc/ppp/pap-secrets
# Secrets for authentication using PAP
# client server secret IP addresses
“bigboy-login@isp” * ”password”
[root@bigboy network-scripts]#
Simple Troubleshooting
> You can run the adsl-status command to determine the condition of your connection. In this case the package has been installed but the interface hasn’t been activated.
[root@bigboy tmp]# adsl-status
Note: You have enabled demand-connection; adsl-status may be inaccurate.
adsl-status: Link is attached to ppp0, but ppp0 is down
[root@bigboy tmp]#
> After activation, the interface appears to work correctly.
[root@bigboy tmp]# ifup ppp0
[root@bigboy tmp]# adsl-status
adsl-status: Link is up and running on interface ppp0
ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1462 inet
...
...
...
[root@bigboy tmp]#
> For further troubleshooting information you can visit the website of rp-ppoe at Roaring Penguin (www.roaringpenguin.com). There are some good tips there on how to avoid problems with VPN clients.
IP Address Assignment For A Cable Modem Connection
Cable modems use DHCP to get their IP addresses so you can configure your server’s ethernet interface accordingly.
How To Activate / Shutdown Your NIC
The ifup and ifdown commands can be used respectively to activate and deactivate a NIC interface. You must have an ifcfg file in the /etc/sysconfig/network-scripts directory these commands to work. Here is an example for interface eth0:
[root@bigboy tmp]# ifdown eth0
[root@bigboy tmp]# ifup eth0
How To Change Your Default Gateway
This can be done with a simple command. This example uses a newly installed wireless interface called wlan0, most PCs would be using the standard ethernet interface eth0.
[root@bigboy tmp]# route add default gw 192.168.1.1 wlan0
In this case, make sure that the router / firewall with IP address 192.168.1.1 is connected to the same network as interface wlan0 !
Once done, you’ll need to update your /etc/sysconfig/network file to reflect the change. This file is used to configure your default gateway each time Linux boots.
NETWORKING=yes
HOSTNAME=bigboy
GATEWAY=192.168.1.1
Some people don’t bother with this step and just place the “route add” command in the file /etc/rc.d/rc.local
How Configure Two Gateways
Some networks may have multiple router / firewalls providing connectivity. Here’s a typical scenario:
> You have one router providing access to the Internet which you’d like to have as your default gateway (See the default gateway example above)
> You also have another router providing access to your corporate network using addresses in the range 10.0.0.0 to 10.255.255.255. Let’s assume that this router has an IP address of 192.168.1.254
The Linux box used in this example uses interface wlan0 for its Internet connectivity. You may be most likely using interface eth0, please adjust your steps accordingly.
Add the new route as follows:
route add -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.1.254 wlan0
The file etc/sysconfig/static-routes will also have to updated so that the route is reinstated when you reboot. Here is a sample.
wlan0 net 10.0.0.0 netmask 255.0.0.0 gw 192.168.1.254
Some people don’t bother with this step and just place the “route add” command in the file /etc/rc.d/rc.local. A more complicated /etc/sysconfig/static-routes file is located in a following section.
How To Delete A Route
Here’s how to delete the routes added in the previous section.
route del -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.1.254 wlan0
The file etc/sysconfig/static-routes will also have to be updated so that when you reboot the server will not reinsert the route. Delete the line that reads:
wlan0 net 10.0.0.0 netmask 255.0.0.0 gw 192.168.1.254
How To View Your Current Routing Table
The netstat -nr command will provide the contents of the touting table. Networks with a gateway of 0.0.0.0 are usually directly connected to the interface. As no gateway is needed to reach your own directly connected interface then an address of 0.0.0.0 seems appropriate.
> In this example there are two gateways, the default and one to 255.255.255.255 which is usually added on DHCP servers. Server bigboy is a DHCP server in this case.
[root@bigboy tmp]# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
255.255.255.255 0.0.0.0 255.255.255.255 UH 40 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 40 0 0 wlan0
127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo
0.0.0.0 192.168.1.1 0.0.0.0 UG 40 0 0 wlan0
[root@bigboy tmp]#
> In this example, there are multiple gateways handling traffic destined for different networks on different interfaces.
[root@bigboy tmp]# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
172.16.68.64 172.16.69.193 255.255.255.224 UG 40 0 0 eth1
172.16.11.96 172.16.69.193 255.255.255.224 UG 40 0 0 eth1
172.16.68.32 172.16.69.193 255.255.255.224 UG 40 0 0 eth1
172.16.67.0 172.16.67.135 255.255.255.224 UG 40 0 0 eth0
172.16.69.192 0.0.0.0 255.255.255.192 U 40 0 0 eth1
172.16.67.128 0.0.0.0 255.255.255.128 U 40 0 0 eth0
172.160.0 172.16.67.135 255.255.0.0 UG 40 0 0 eth0
172.16.0.0 172.16.67.131 255.240.0.0 UG 40 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo
0.0.0.0 172.16.69.193 0.0.0.0 UG 40 0 0 eth1
[root@bigboy tmp]#
> Here is what the static routes file looks like for this multi-homed (Multiple NICs) server
[root@bigboy tmp]# more /etc/sysconfig/static-routes
eth0 net 172.16.0.0 netmask 255.240.0.0 gw 172.16.67.131
eth0 net 172.160.0 netmask 255.255.0.0 gw 172.16.67.135
eth0 net 172.16.67.0 netmask 255.255.255.224 gw 172.16.67.135
eth1 net 172.16.68.64 netmask 255.255.255.224 gw 172.16.69.193
eth1 net 172.16.68.32 netmask 255.255.255.224 gw 172.16.69.193
eth1 net 172.16.11.96 netmask 255.255.255.224 gw 172.16.69.193
[root@bigboy tmp]#
How To Change The Duplex Setting Of Your NIC
There is no better Linux investment than the purchase of a fully Linux compatible NIC card. Most Linux vendors will have a list of compatible hardware on their websites, read this carefully before you start hooking up you machine to the network. If you can’t find any of the desired models in your local computer store, then a model in the same family or series should be sufficient. Most cards will work, but only the fully compatible ones will provide you with error free, consistent throughput.
My experience has been that Ethernet NICs built into motherboards (onboard NICs) frequently don’t negotiate port speed and duplex correctly. An onboard NIC may be adequate for a home system, but you should invest in a compatible card when using Linux in a SOHO environment.
You can manage the duplex and speed settings of your NIC with the mii-tool command. It is best to use this command with compatible hardware.
In the example below, we can see the output of the command verbose “-v” mode. In this case, negotiation was OK, with the NIC selecting 100Mbps, full duplex mode (FD).
[root@bigboy tmp]# mii-tool -v
eth1: negotiated 100baseTx-FD, link ok
product info: vendor 00:10:18, model 33 rev 2
basic mode: autonegotiation enabled
basic status: autonegotiation complete, link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
[root@bigboy tmp]#
You can set your NIC to force itself to a particular speed and duplex by using the “-F” switch with any of the following options: 100baseTx-FD, 100baseTx-HD, 10baseT-FD, or 10baseT-HD. Remember that you could lose all network connectivity to your server if you force your NIC to a particular speed/duplex that doesn’t match that of your switch.
[root@bigboy tmp]# mii-tool -F 100baseTx-FD eth0
I have seen where NICs appear to work with failed negotiation, but this is usually accompanied by many “collision” type errors being seen on the NIC when using the ifconfig -a command and only marginal performance. The causes for this could include an incompatible NIC, incorrect settings on your switch port or a bad cable.
How To Convert Your Linux Server Into A Router
Configuring IP Forwarding
For your Linux server to become a router, you have to enable packet forwarding. In simple terms packet forwarding lets packets flow through the Linux box from one network to another.
The configuration parameter to activate this is found in the file /etc/sysctl.conf. Remove the “#” from the line related to packet forwarding.
Before
# Disables packet forwarding
#net.ipv4.ip_forward=1
After
# Enables packet forwarding
net.ipv4.ip_forward=1
This will only enable it when you reboot at which time Linux will create a file in one of the subdirectories of the special RAM memory based /proc filesystem. To activate the feature immediately you have to create a single lined text file called /proc/sys/net/ipv4/ip_forward and it only contain the value “1″. Here is how it’s done:
[root@bigboy tmp] echo 1 > /proc/sys/net/ipv4/ip_forward
Configuring Proxy ARP
If a server needs to send a packet to another device on the same network, it sends out an ARP request to the network asking for the MAC address of the other device.
If the same server needs to send a packet to another device on a remote network the process is different. The server first takes a look at its routing table to find out the IP address of the best router on its network which will be able to relay the packet to the destination. The server then sends an ARP request for the MAC address that matches the router’s IP address. It then sends the packet to the router using the routet’s MAC address, but a destination IP address of the remote server.
If there is no suitable router on its network, the server will then send out an ARP request for the MAC address of the remote server. Some routers can be configured to answer these types of ARP requests for remote networks. This feature is called “proxy ARP”. There are some disadvantages with this. One of the most common problems occurs if two routers are on the network configured for proxy ARP. In this scenario there is the possibility that either one will answer the local server’s ARP request for the MAC address of the remote server. If one of the routers has an incorrect routing table entry for the remote network, then there is the risk that traffic to the remote server will occasionally get lost. In other words you can lose routing control.
Note: It is for this and other reasons that it is generally not a good idea to configure proxy ARP on a router. It is also good to always configure a default gateway on your server and use separate routing entries via other routers for all networks your default gateway may not know about.
If you need to enable proxy ARP on a Linux server the /proc filesystem comes into play again. Proxy ARP is handled by files in the /proc/sys/net/ipv4/conf/ directory. This directory then has sub-directories corresponding to each functioning NIC card on your server. Each subdirectory then has a file called proxy_arp. If the value within this file is “0″, then proxy ARP on the interface is disabled; if the value is “1″ then it is enabled.
You can use the “echo” command to insert the correct values into each file. The example below activates proxy ARP for interfaces eth0 and wlan0.
[root@bigboy tmp] echo 1 > /proc/sys/net/ipv4/conf/eth1/proxy_arp
[root@bigboy tmp] echo 1 > /proc/sys/net/ipv4/conf/wlan0/proxy_arp
The following command will enable it for all interfaces.
[root@bigboy tmp] echo 1 > /proc/sys/net/ipv4/conf/all/proxy_arp
(You can determine your network interface names with the ifconfig -a command)
There is no purpose built configuration file to force Linux to do proxy ARP on booting. The best way to do this is put the commands above in your /etc/rc.d/rc.local file
echo 1 > /proc/sys/net/ipv4/conf/eth1/proxy_arp
echo 1 > /proc/sys/net/ipv4/conf/wlan0/proxy_arp
Configuring Your /etc/hosts File
The /etc/hosts file is just a list of IP addresses and their corresponding server names. Your server will typically check this file before referencing DNS, if the name is found with a corresponding IP address then DNS won’t be queried at all. Unfortunately, if the IP address for that host changes, you’ll have to update file. For ease of management, it is best to limit entries in this file to just the loopback interface, and also the server’s own host name and use the centralized DNS server handle the rest.
192.168.1.101 smallfry
In the example above server “smallfry” has an IP address of 192.168.1.101. You can access 192.168.1.101 using the “ping”, “telnet” or any other network aware program by referring to it as “smallfry” Here is an example using the “ping” to see if “smallfry” is alive and well on the network.
[root@bigboy tmp]# ping smallfry
PING zero (192.168.1.101) 56(84) bytes of data.
64 bytes from smallfry (192.168.1.101): icmp_seq=0 ttl=64 time=0.197 ms
64 bytes from smallfry (192.168.1.101): icmp_seq=1 ttl=64 time=0.047 ms
— smallfry ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 2017ms
rtt min/avg/max/mdev = 0.034/0.092/0.197/0.074 ms, pipe 2
[root@bigboy tmp]#
You can also add “aliases” to the end of the line which will allow you to refer to the server using other names. Here we have set it up so that “smallfry” can also be accessed using the names “tiny” and “littleguy”.
192.168.1.101 smallfry tiny littleguy
You should never have an IP address more than once in this file as Linux will only use the values in the first entry it finds.
192.168.1.101 smallfry # (Wrong)
192.168.1.101 tiny # (Wrong)
192.168.1.101 littleguy # (Wrong)
The Loopback Interface’s Localhost Entry
Usually the very first entry in /etc/hosts defines the IP address of the server’s virtual loopback interface. This is usually mapped to the name localhost.localdomain (the universal name used when a server refers to itself) and localhost (the shortened “alias” name). By default, Fedora inserts the hostname of the server between the 127.0.0.1 and the localhost entries like this:
127.0.0.1 bigboy localhost.localdomain localhost
When the server is connected to the Internet this first entry after the 127.0.0.1 needs to be the fully qualified domain name (FQDN) of the server. For example, bigboy.mysite.com, like this:
127.0.0.1 bigboy.my-site.com localhost.localdomain localhost
Some programs such as Sendmail are very sensitive to this and if they detect what they feel is an incorrect FQDN they will default to using the name “localhost.localdomain” when communicating with another server on the network. This can cause confusion, as the other server also feels it is “localhost.localdomain”.
Note: You MUST always have a localhost and localhost.localdomain entry mapping to 127.0.0.1 for Linux to work properly.
从开放系统世界上学来的。
1、让tail不停地读地最新的内容
2、查看文件中间的第五行(含)到第10行(含)的内容
3、使系统对ping没反应
4、使tcp syn cookie保护生效
5、find命令使用参数
find / -name access_log 2>/dev/null 不显示错误信息
find /-amin n ##查找系统中最后N分钟访问的文件
find /-atime n ##查找系统中最后n*24小时访问的文件
find /-cmin n ##查找系统中最后N分钟被改变状态的文件
find /-ctime n ##查找系统中最后n*24小时被改变状态的文件
find /-empty ##查找系统中空白的文件,或空白的文件目录,或目录中没有子目录的文件夹
find /-false ##查找系统中总是错误的文件
find /-fstype type ##查找系统中存在于指定文件系统的文件,例如:ext2 .
find /-gid n ##查找系统中文件数字组 ID 为 n的文件
find /-group gname ##查找系统中文件属于gnam文件组,并且指定组和ID的文件
find / -mmin n # 查找在系统中最后n分钟里修改过的文件
find / -mtime n #查找在系统中最后24*n小时里修改过的文件
find / -nouser #查找在系统中属于作废用户的文件
find / -size nc #查找在系统中长度为n字节的文件
find / -size +nc #查找在系统中长度大于n字节的文件
find / -daystart ##测试系统从今天开始24小时以内的文件,用法类似-amin
find / -depth ##使用深度级别的查找过程方式,在某层指定目录中优先查找文件内容
find / -follow ##遵循通配符链接方式查找; 另外,也可忽略通配符链接方式查询
find / -help ##显示命令摘要
find / -maxdepth levels ##在某个层次的目录中按照递减方法查找
find / -mount ##不在文件系统目录中查找, 用法类似 -xdev.
find / -noleaf ##禁止在非UNUX文件系统,MS-DOS系统,CD-ROM文件系统中进行最优化查找
find / -version ##打印版本数字
-exec command; ##查找并执行命令
-fprint file ##打印文件完整文件名
-fprint0 file ##打印文件完整文件名包括空的文件
-fprintf file format ##打印文件格式
-ok command; ##给用户命令执行操作,根据用户的Y 确认输入执行
-printf format ##打印文件格式
-ls ##打印同种文件格式的文件.
几个参数之间可以用-and,-or连接,某个参数取反可用!.
开放世界上的对find的说明,好象有些问题。
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明
http://www.5ilinux.com/samba.html
Fedora Core 1服务器调试手记<一>
关键字 samba fedora smb smbclient smbpasswd
Samba3.0服务器实战调试
fedora预装的samba已经是samba-3.0.0-15,功能已经非常强大了,今天我们调试的重点不是samba3.0的新功能,我们还是先来实现他的基本功能,文件共享服务,至于域控制器功能我会在以后的调试手记中阐述。
我们今天要实现的环境是,假如公司有财务,技术,领导3个部门,我们分别为3个部门建立3个用户组为caiwu,network,lingdao;
三个部门里各有2个用户,我们建用户分别为caiwu01,caiwu02,network01,network02,lingdao01,lingdao02
然后我们分别就公司的具体情况建立相应的目录及访问权限,通过以下的例子,希望大家能在平时的工作中灵活的应用samba的安全权限来设置你们的samba文件服务器。
1。首先服务器采用用户验证的方式,每个用户可以访问自己的宿主目录,并且只有该用户能访问宿主目录,并具有完全的权限,而其他人不能看到你的宿主目录。
2。建立一个caiwu的文件夹,希望caiwu组和lingdao组的人能看到,network02也可以访问,但只有caiwu01有写的权限。
3。建立一个lindao的目录,只有领导组的人可以访问并读写,还有network02也可以访问,但外人看不到那个目录
4。建议一个文件交换目录exchange,所有人都能读写,包括guest用户,但每个人不能删除别人的文件。
5。建议一个公共的只读文件夹public,所有人只读这个文件夹的内容。
好,我们先来前期的工作
#groupadd caiwu
#groupadd network
#groupadd lingdao
#useradd caiwu01 -g caiwu
#useradd caiwu02 -g caiwu
#useradd network01 -g network
#useradd network02 -g network
#useradd lingdao01 -g lingdao
#useradd lingdao02 -g lingdao
然后我们使用smbpasswd -a caiwu01的命令为6个帐户分别添加到samba用户中
#mkdir /home/samba
#mkdir /home/samba/caiwu
#mkdir /home/samba/lingdao
#mkdir /home/samba/exchange
#mkdir /home/samba/public
我们为了避免麻烦可以在这里把上面所有的文件夹的权限都设置成777,我们通过samba灵活的权限管理来设置上面的5点要求。
以下是我的smb.conf的配置文件
[global]
workgroup = bmit
#我的网络工作组
server string = Frank’s Samba File Server
#我的服务器名描述
security = user
#使用用户验证机制
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
#使用加密密码机制,在win95和winnt使用的是明文其他的基本上可以按照默认的来。
[homes]
comment = Home Directories
browseable = no
writable = yes
valid users = %S
create mode = 0664
directory mode = 0775#homes段满足第1条件
[caiwu]
comment = caiwu
path = /home/samba/caiwu
public = no
valid users = @caiwu,@lingdao,network02
write list = caiwu01
printable = no#caiwu段满足我们的第2要求
[lingdao]
comment = lingdao
path = /home/samba/lingdao
public = no
browseable = no
valid users = @lingdao,network02
printable = no#lingdao段能满足我们的第3要求
[exchage]
comment = Exchange File Directory
path = /home/samba/exchange
public = yes
writable = yes#exchange段基本能满足我们的第4要求,但不能满足每个人不能删除别人的文件这个条件,即使里设置了mask也是没用,其实这个条件只要unix设置一个粘着位就行
chmod -R 1777 /home/samba/exchange
注意这里权限是1777,类似的系统目录/tmp也具有相同的权限,这个权限能实现每个人能自由写文件,但不能删除别人的文件这个要求
[public]
comment = Read Only Public
path = /home/samba/public
public = yes
read only = yes#这个public段能满足我们的第5要求。
到此为止我们的设置已经能实现我们的共享文件要求,记得重启服务哦
#/etc/rc.d/init.d/smb restart
如果大家没有winodws,不妨先用samba的cilent端命令来测试一下
命令的用法我在这里只举几个例子,具体的大家去试验
smbclient -L 服务器ip -N
guest帐户查询你的服务器的samba共享情况,你可以检验一下是否lingdao目录时候能被guest帐户看到,应该是看不到的,当然你也可以以某个用户的名义查看
smbclient -L 服务器ip -U caiwu01
系统会提示密码,只要输入smb密码就行。
smbclient //服务器ip/caiwu -U caiwu01
#以caiwu01用户的名义登录caiwu目录
smbmount //服务器ip/caiwu /mnt/caiwu -o username=caiwu01
#把服务器的财务目录映射到本地的/mnt/caiwu目录
关于samba的其他用法我会在后续的文章中继续,请大家等待!
参考资料
Samba 配置 http://www.linuxfocus.org/ChineseGB/March2002/article177.shtml
O’Reilly 线上书籍:http://www.oreilly.com/catalog/samba/chapter/book/index.html
Samba3.0轻松搞定PDC域服务器 http://www.5ilinux.com/samba01.html
作者:张微波
2003年11月12日于北京
| Linux全球统一标准即将出台 避免走Unix老路 | |||||||||
|---|---|---|---|---|---|---|---|---|---|
|
|
|||||||||
| http://www.sina.com.cn 2004年09月14日 07:14 新浪科技 | |||||||||
![]() Linux全球统一标准即将出台 避免走Unix老路(新浪科技配图) 点击此处查看全部科技图片 新浪科技讯 自由标准组织(Free Standards Group)计划在北京时间9月14日正式公布一个Linux全球标准,以阻止Linux进一步分化的趋势。目前这一标准获得了从Linux开发商到PC制造商的广泛支持,其中包括Red Hat、Novell、红旗、Turbolinux、AMD、英特尔、惠普、戴尔和IBM等。 自由标准组织将宣布的标准名为Linux标准库2.0(Linux Standard Base 2.0),目的
是避免Linux分化成为几个互相不兼容的版本。这种情况数年前曾经在Unix操作系统上发生过,当时几家公司分别开发了差异较大且互不兼容的Unix版本。另一个非盈利性组织Linux International的执行理事乔恩-豪尔(Jon Hall)表示:“如果没有一个标准版的Linux操作系统,我们必然会走上Unix的老路。” 自由标准组织执行理事吉姆-泽林(Jim Zemlin)认为,要同微软的Windows操作系统竞争,Linux系统必须有一个统一的标准。Linux的最大优势就在于它是一种开放标准,任何人都可以自由访问它的源代码。然而近年来以Red Hat和Novell为首的商业公司经常在Linux中加入各种不同的功能,以使它们的产品和服务对用户更具吸引力。在这种情况下,Linux支持者开始担心未来的Linux会像Unix一样分化为多个不同的版本,削弱在市场上的竞争力。 微软已经充分意识到Linux存在的这一潜在危机,该公司在欧洲市场打出广告,向消费者展示一旦Linux分化为几种不同版本,用户可能会遇到的混乱和困扰。在微软的广告中,作为Linux标志的企鹅长出了青蛙的腿和大象的鼻子。泽林说:“不得不承认,这是一个非常好的广告。” 在过去,如果某一厂商为Linux加入了特殊的功能,该厂商就必须在多个版本的Linux平台下进行测试,以确保兼容性,今后这一情况将大大改观。惠普Linux市场营销部分经理杰弗里-韦德(Jeffrey Wade)表示:“新标准的推出将大大降低厂商的开发成本,因为今后厂商只需要在标准版Linux下完成测试就可以了。” IBM技术中心副总裁丹-弗莱(Dan Fry)认为,Linux系统分化的威胁并没有人们想象的那样大,因为Linux的所有变化都在“Linux之父”莱纳斯-托瓦德斯(Linus Torvaalds)的监控之中。不过弗莱同时表示:“无论如何,对软件厂商和用户而言,一个统一的标准是非常重要的。”(飞仙编译) |
理解 Xwindow
很多人在用 Xwindow,但是他们是在用一些包装掩盖下的 Xwindow,那些包装有些很不稳定,占用大量资源,以至于有人说 Xwindow 是垃圾。其实 Xwindow 是一个非常出色的图形系统,你应该抱怨的是那些不稳定的包装,而不是 Xwindow 本身。
Xwindow 是非常巧妙的设计,很多时候它在概念上比其它窗口系统先进,以至于经过很多年它仍然是工作站上的工业标准。许多其它窗口系统的概念都是从 Xwindow 学来的。
Xwindow 可以说的东西太多了。下面只分辨一些容易混淆的概念,提出一些正确使用它的建议。
分辨 X server 和 X client
这是我被别人问了好多次的问题,我实在不想再对人说一遍了,所以写在这里偷个懒,嘿嘿。
很多熟悉 Internet 原理的人首次遇到 Xwindow 的这两个概念都会搞错。如果他从一台 Windows 机器上使用 Exceed 通过 XDMCP 登录到一台 Sun 服务器,他就说 Exceed 是客户端(client),而 Sun 机器是服务器(server)。这就完全搞错了。
理解了 Xwindow 的工作原理,这个区别就会很明显。X server 不是指你登录的那台机器,而是指一个程序,它负责在某台机器上接受客户的要求,在屏幕上显示客户请求的图形,并且把消息(键盘,鼠标,窗口消息)通知客户程序。
比如上面例子里的 Exceed 就是一个 X server,它负责控制那台 Windows 机器上的显示(display),Sun 机器上的程序,xterm, xxgdb, dtwm(CDE的窗口管理器),……是客户程序。它们通常会使用 TCP 6000 号端口连接 Windows 机器,而Windows机器的 6000 号端口是由 Exceed bind 和 listen 的,怎么样,我们的 Internet 专家,Exceed 看起来是一个 server 吧
比如,当你通过 telnet 启动 Sun 机器上的 xterm,就会在 Exceed 的屏幕上显示一个窗口。实际发生的事情是: xterm 请求连接 Windows 机器的 6000 号端口,与Exceed 跟 Exceed 连接,然后xterm请求得到资源,然后 xterm 请求在屏幕上显示一个窗口。
你在 xterm 的窗口里按下”A”键时,Exceed 会把这个事件通知 xterm 进程,然后 xterm 会发送数据报,请求 Exceed, “请在坐标(100,30)处显示一个字母A,然后在后面显示一个矩形作为光标。”,这样你的 xterm 窗口里就会多显示一个字母。
这下你理解了吗?不?那还是自己多用用,体会体会吧。
Xwindow 的网络透明性
刚才那个 Exceed 用户,他的客户程序不仅可以运行在那台 Sun 机器上,而且可以运行在网络里其它的机器上,或者在本机上。比如他有可能同时通过 telnet 登录到几台 Sun 工作站,几台 Linux PC,他可以在那些机器上都起动 xterm,在这台 Windows 机器上的 Exceed 上显示。如果它安装了 cygwin,他还可以启动本机上的 cygwin里 的 xterm,用同样的方式显示。
如果他使用 xrdb 在本机的 Exceed 设置了 xterm 的样式,比如背景 midnightblue, 前景 白色,字体 -*-adobe-courier-*,……,那么,Sun, Linux, cygwin 里的 xterm,虽然没有经过配置,但是它们知道:“这个 X server 要求我用这个背景色,这个前景色,这个字体……”,它们会在你的屏幕上显示同样风格的窗口。
使用鼠标选择一段字符,然后就可以在另外的程序里按鼠标中间,把字符粘贴过去。不论这个程序运行在哪里。
看看更大的一个图景:你的屏幕上有三台机器上的 xterm, 两台机器上的 gvim,两台机器上的 mozilla 在显示,而它们都受本机的 FVWM 操纵,它们之间可以随意进行拷贝粘贴…… 从这里你可以初步体会到 Xwindow 的网络透明性,它使你方便的操作很多机器。
什么是窗口管理器?
很多人不知道窗口管理器是怎么回事。他们认为 Gnome 和 KDE 是窗口管理器,认为窗口管理器就是能够提供一个工具条,能够配置桌面背景,能够设置很多菜单的东西。而其实,窗口管理器只是 Gnome 和 KDE 的一部分,它的主要功能是你平时根本没有注意,但是却非常重要的操作。窗口管理器的主要功能是:移动窗口,改变窗口大小,图标化(最小化)窗口,改变窗口层叠顺序……
通常的X客户程序不需要知道有人想移动它,它只知道乖乖听窗口管理器的话。如果没有窗口管理器运行,你的程序会一个堆一个,你没有办法操纵被盖在下面的程序,你只能使用最上面一个程序,而且你不能移动它,你不能改变它的大小。这样的系统根本不能用!
其实你的窗口上的标题,按钮,漂亮的边框,全都是窗口管理器提供的,而不是程序自己的,这样你用窗口管理器就能改变任何窗口的样式了。当你点击关闭窗口的那个按钮,你其实点击的是窗口管理器放在你的程序窗口上面的一个小窗口,发现它受到点击后,窗口管理器就会通知那个程序:“喂!有人想关掉你,你自己准备准备后事,然后退出吧。”
不同的机器在本机显示的窗口,由窗口管理器统一装饰和指挥。比如,窗口管理器决定: xterm 窗口上面都应该有四个按钮,一个在左边,点击它会显示窗口操作菜单,另外三个在右边,分别是最大化,最小化和关闭。窗口都使用 7pixel 厚的边框,窗口首次出现的时候首先在桌面上找一个空位置,如果找不到,就找一个能够最少的遮盖其它窗口的位置……
这些都是窗口管理器的职责。
Gnome 和 KDE 是什么?
有人把 Gnome 和 KDE 叫做窗口管理器,甚至还有人把它们叫做 Xwindow。经常看到有人问:“装哪种 Xwindow 好啊?Gnome 还是 KDE?” 其实你不安装 Gnome 和 KDE 也可以使用 Xwindow.
Gnome 和 KDE 是“桌面系统”,一种很多程序和函数库的集合。它们的设计目的是提供一致的方便的操作方式来满足普通用户的需要。它们不但包含窗口管理器,还有很多实用程序和应用程序,比如配置程序,工具条,编辑器,绘图工具…… 其实 Gnome 可以和很多窗口管理器合作,在历史上,Gnome 使用过的窗口管理器包括 englightenment, sawmill, sawfish, metacity。KDE 的窗口管理器叫做 kwin。
你也知道,设计整整一套应用程序:编辑器,绘图程序,浏览器,…… 是非常不容易的。所以它们肯定是不如专用的编辑器,绘图程序,浏览器的。不过要求不太高的用户也可以用它们。
用 Xwindow 做一个有趣的试验
现在我们来做一个试验来引起你对 Xwindow 的兴趣。
很多人离开了 xdm 就不知道怎样启动 “Xwindow” 了。其实 Xwindow 的启动方式很简单。
首先,启动你的 X server。在 Linux 下,你可以直接输入 “X&”,让一个 X server 在后台运行。这样,一个占据整个屏幕的布满斜纹的窗口(根窗口)就出现了。如果是 Exceed 或者 X-win32,你需要把屏幕设置为 “single window” 才能看到这个窗口。
接着,Linux 用户需要用 xauth 给你的 X server 设置一个密码,这样别人就不能非法连接你的 X server。你需要Ctrl-Alt-F1切换到tty1才能输入这个命令。Exceed 和 X-win32 的用户不需要这步。以下的例子只用 Linux 作为实例,其它系统的用户可以依葫芦画瓢。
xauth add :0 . `mcookie`
好了,现在你可以试试启动一个 xterm 到这个 X server 上:
xterm -display :0
按 Alt-F7 切换到 X,你看到了一个不受窗口管理器管理的 xterm。试试移动它呢?再切换到 tty1 启动另一个 xterm,两个 xterm 重合了吗?你怎样在第一个 xterm 里输入呢?这样用起来很痛苦吧?那么你可以在 xterm 里启动一个窗口管理器,比如 twm,直接运行 “twm&” 就行了。
你发现xterm的窗口都被加上了标题栏,按钮和边框,你现在可以移动它们了。试试把 twm 杀死,看看那些标题栏,按钮,边框是不是都消失了?你知道了窗口管理器的作用了吧。
现在告诉你怎样不用 XDMCP broadcast,绕过 CDE 的登陆界面,而使用 Sun 机器上的 CDE。其实你只需要把刚才那个例子里的 “twm” 换成 CDE 的窗口管理器 dtwm 就行了,或者启动 dtsession。它们一般在 /usr/dt/bin 下。Sun 还有另外一个窗口管理器叫做 OpenLook, 它在系统里的名字叫做 olwm,你自己找找吧。
现在如果你自己在 Sun 机器上装一个 FVWM,你知道怎么绕过 CDE 登录而启动 FVWM 了吧?你不需要成为 root 就可以使用你喜欢的FVWM了。
.Xdefaults 文件的作用
弄明白 X 的工作原理后,你就可以使用 .Xdefaults 来配置你的程序了。有人不理解 .Xdefaults 是用来干什么的,喜欢用 shell alias 出一些带有很多参数的命令,或者写一些 shell script,里面只有一行带有很多参数的程序调用,然后他说:“.Xdefaults 没用。”
其实 .Xdefaults 比起这些办法有很多好处。首先,几乎所有的 X 客户程序都可以从 .Xdefaults 文件得到配置信息,比如前景色,背景色,字体…… 这样你可以在同一个文件里配置所有 X 程序的样式,而不用写那么多 shell script。
另外,如果你用 xrdb .Xdefaults 把这些配置信息写入到根窗口的数据结构里,不是本地机器上的 X 程序也会遵守同样的样式。比如如果你的 .Xdefaults 里面有这些内容:
XTerm.background: midnightblue XTerm.foreground: white
然后你用 xrdb ~/.Xdefaults,那么所有的 xterm 都会使用 midnightblue 作为背景色,使用白色显示字符。这些配置,用X术语叫资源(resource)。
有时候你会开很多 xterm 窗口在机器上,它们来自不同的远程机器,这时候如果它们都用同样的样色和字体,你就不容易分辨它们了。比如有一天,我在实验室的PC机上打开了很多 xterm,它们来自本机,实验室的 Sun 服务器,我宿舍的机器和数据库实验室一台 HP 服务器。在我走之前,想关闭本地的机器,我输入 “shutdown -h now” 在一个我自认是本地的 xterm 上,结果,等了一会儿,我回头看到机器没关掉,只是那个 xterm 停止了响应。我一拍脑袋:糟了,我把宿舍的机器给关掉了!
为了避免这种情况,你可以在不同的机器上编辑不同的 .Xdefaults,而不使用 xrdb 在根窗口导入这些配置。这样不同的机器上的 xterm 使用不同的颜色,你就不容易搞错了。
怎样更加深入的了解 Xwindow?
哎哟!我本来想写很多东西,后来发现要需要写的实在太多了。我没那么多时间,没办法,给参考书目吧,你们自己去看。
学习使用 Xwindow 不是学习使用 Gnome,KDE,…… 很多书籍教用户怎样使用 Gnome, KDE 的菜单,配置程序…… 结果到了最后用户还是没能知道 Xwindow 是怎么回事。用那些菜单谁不会啊?真是浪费大家时间。
学习 Xwindow,其实最好的一个办法是看看 Xlib 编程的书籍,你可以在图书馆找到这样的书,我推荐 O’reily 的那本 Xlib 程序设计书(我忘了名字了),虽然它很老,但是那上面讲解的 Xwindow 的工作原理一直都没有变过。
如果你不会编程序,你可以不看编程的部分而得到很多深入的概念上的认识,比如窗口属性,字体,颜色,…… 这些东西在你使用 Xwindow 时会有很大帮助。如果你真的要编写 Xlib 程序,这本书就过时了一点,你最好到 www.x.org 去免费下载最新的 Xlib 手册来看。
|
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||


