2008年1月 Archives
参考微软网站的文章。详细请见:
http://www.microsoft.com/china/technet/prodtechnol/windowsserver2003/technologies/directory/activedirectory/stepbystep/domcntrl.mspx
域服务器端Active Directory:
准备好 Windows Server 2003 CD
选择“只与 Windows 2000 或 Windows Server 2003 操作系统兼容的权限”(默认)
安装完dns服务器后,重新启动机器 发现机器dns改变,成为127.0.0.1
用户和机器配置:
客户端:
我的电脑--属性--计算机名 配置域登录。
注意先把机器的dns改为域服务器的IP地址。
登录域时写入域服务器名称。
新建用户,密码强度有所要求。
java 访问url ,可以使用类似IE中设置的代理服务器进行访问。
java的net包里面就有proxy类,通过这个类进行代理设置,在程序对url进行访问之前调用这个方法即可。
public static void ProxySet()
{
Properties sys = System.getProperties();
sys.put("proxySet", "true");
sys.put("proxyHost", "61.19.148.233");//代理服务器ip
sys.put("proxyPort", "8080");//代理服务器端口
System.setProperties(sys);
}
今天遇到朋友问我这样一个问题,托管的服务器ssh不好用了,无法登录。
症状是: ssh 端口可以telnet 通,但是就是无法远程登录上去,用同网段的另外一台服务器可以登录上去,
比较奇怪,于是让我帮忙看看。
我中转登上去看了一下,经历了如下步骤:
- iptables没有问题,iptables -vnL 看一了下规则,也没有问题,保险起见我把iptables停掉了,
- 检查ssh服务,看了sshd的配置,重启服务,未果。
- 查看了系统日志,检测一下是否被人入侵了,/var/log 全面检测,发现没有什么异样。
这就奇怪了,难道要我重装sshd吗?
- 查看/etc/hosts.allow 和/etc/hosts.deny ,原来问题再这里,
里面有类似这样的设置:
[root@2hei.net ]# more /etc/hosts.allow
#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
sshd:192.168.1.100:allow
vsftpd:192.168.1.100:allow
[root@2hei.net ]# more /etc/hosts.deny
#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
sshd:ALL:deny
vsftpd:ALL:deny
把/etc/hosts.deny的注释掉,或者把/etc/hosts.allow加上允许的IP即可。
总结一下:
iptables和hosts文件共同使用是,注意ip段。
另外hosts并不能禁掉ssh的端口,其他人虽然无法登陆,但是telnet ssh端口却可以发现服务开着,所以iptables还是有必要使用的。
DOS下操作windows注册表:
---- REG ADD[\\Machine\]Keyname[/v ValueName|/ve][/t Type][/s Separator][/d Data][/f]
---- Machine用来指定远程计算机名称,如果操作的是本地计算机则此参数省略。如果要远程操作名为Server的计算机,其Machine参数表示为"\\Server"。
---- Keyname用来指定在注册表的哪个项下新建注册表值,这个参数必须用注册表项的全路径表示,不过注册表的4个根键一般用缩写表示(各个根键所对应的缩写如表1所示)。例如希望操作的注册表项是"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon",则Keyname参数表示为"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"。注意:如果操作的是远程计算机的注册表,只能使用HKLM和HKCU这2个根键。
我在实际中使用了如下的两种方式:
修改默认的浏览器为IE:
新建文件 ie.reg
REGEDIT4
[HKEY_CLASSES_ROOT\HTTP\shell\open\command] @="C:\\Program Files\\Internet Explorer\\iexplore.exe"
说明:@标识默认键值
###########################################
--使用DOS命令执行新建键值
REG ADD HKEY_CLASSES_ROOT\HTTP\shell\open\command /ve /d "C:\Program Files\Internet Explorer\iexplore.exe" /f
REG ADD HKEY_CLASSES_ROOT\HTTP\shell\open\ddeexec\Application /ve /d "IExplore" /f
参数说明:
/ve表示在指定的注册表项下创建键值名称为"默认"的注册表值
/d Data用来指定创建的注册表值的数据。
/f用来指定当要添加的注册表值存在时是否覆盖。
/s Separator的作用是当数据类型为REG_MULTI_SZ时,利用参数来指定分隔字符串的字符。
/t Type用来指定创建的注册表值的数据类型,如果不指定,系统默认使用REG_SZ数据类型
################
在java程序中可以使用registry-3.1.3.zip这个包来对windows系统的注册表进行修改与操作。
http://www.trustice.com/java/jnireg/index.shtml 下的 registry-3.1.3.zip
可以利用它访问、修改、导出注册表项到文件等。
/**
* 得到注册表的键值 HKEY_LOCAL_MACHINE,"SOFTWARE\\2HEI Key的值
*/
public static String getKeys()
{
String key= "0";
try
{
RegistryKey regkey = Registry.openSubkey(Registry.HKEY_LOCAL_MACHINE,"SOFTWARE\\2HEI",RegistryKey.ACCESS_READ);
String regvalue = regkey.getStringValue("Key");
// System.out.println("---now 2hei's key is :"+regvalue);
key= regvalue+"";
return key;
}
catch (Exception e)
{
System.out.println("--2hei's Key in Reg Has Been Init!:"+e.toString());
}
return key;
}
it's easy,ust add this in your <body>
<body leftmargin=0 topmargin=0 oncontextmenu='return false' ondragstart='return false' onselectstart ='return false' onselect='document.selection.empty()' oncopy='document.selection.empty()' onbeforecopy='return false' onmouseup='document.selection.empty()'>
1. Introduction
edtFTPj/Free is the most popular Java FTP client library available today. Robust, fast and with an extensive API, it provides a solid foundation for developers who require FTP functionality in their Java applications. Full source code is included.
This document provides an overview of the package and links to documentation and examples.
2. Features
edtFTPj/Free's many features include:
- Rock-solid FTP transfers.
- Passive and active modes are supported (PASV and PORT).
- Resuming of interrupted binary transfers supported.
- Progress monitoring of data transfers.
- FTP streams
主页如下: http://www.enterprisedt.com/products/edtftpj/overview.html
edtFTPj是一个FTP客户端包它可以嵌入到应用程序中以便以提供FTP的功能.它提供一些方法如:put(),get(),chdir(),dir()与pwd()等来完成FTP的功能。
API讲的比较详细,其提供的ftp传输包括文件和流的方式比较方便,并且在远程目录的处理上有自己的独到之处。
强烈推荐使用。
因为要做泛解析,单独使用resin2,配置过程中好像有点问题,resin.conf的配置没有关于host的正则表达式。
resin3在解析静态和jsp文件方面已经做的不错了,但是resin3和apache2的配合始终做的不好,我试过了多个apache2的版本,都无法跟resin3配合起来一起使用,倒是resin2的版本可以做到。
因此我一直使用resin3.1.3单独作为web服务器,总体感觉还可以,不足的就是跟resin2的比较起来源码编译的路径不同了,现在必须要放到WEB-INF/classes下面,每次传源码的时候都要重新启动一遍服务器,比较麻烦。
另外resin3的免费版本没有了cache的支持。
有时候重新启动resin的时候提示下面的问题,好像是watchdog的问题,resin3的maillist里有出现过这样的问题。
[root@2hei.net ~]# /usr/local/resin/bin/httpd.sh stop
Resin/3.1.3 can't stop -server ''.
java.lang.IllegalStateException: Can't connect to ResinWatchdogManager.
java.net.ConnectException: http://127.0.0.1:6600/watchdog: Connection refused
还有更为神奇的是,有时候想kill掉resin的进程,却发现resin不死、有个自动复活的精神,刚刚kill掉 ,系统就会自动重新启动resin的进程,呵呵,服了!
网页识别文件的类型一般由 mime-mapping 来指定,
下面是一些mime-mapping类型的说明:
<mime-mapping extension=".html" mime-type="text/html"/>
<mime-mapping extension=".ai" mime-type="application/postscript"/>
<mime-mapping extension=".aif" mime-type="audio/x-aiff"/>
<mime-mapping extension=".aiff" mime-type="audio/x-aiff"/>
<mime-mapping extension=".aifc" mime-type="audio/x-aiff"/>
<mime-mapping extension=".au" mime-type="audio/basic"/>
<mime-mapping extension=".asc" mime-type="text/plain"/>
<mime-mapping extension=".asf" mime-type="video/x-ms-asf"/>
<mime-mapping extension=".asx" mime-type="video/x-ms-asf"/>
<mime-mapping extension=".atom" mime-type="application/atom+xml"/>
<mime-mapping extension=".avi" mime-type="video/x-msvideo"/>
... more ...
启动resin时,后台报出这样的错误,在本地没有任何问题
XSL-1103: (Fatal Error) DOMResult can not be this kind of node.
vi web.xml 把注释掉,把有关stuts的注释掉,启动正常。
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
网上搜索了多时,终于发现时jre环境的问题,
参考了一个E文回帖!
大概的意思就是lib里面使用了不同的版本的引入类。重新整理,并且把多余的去掉就可以了。
[2hei@localhost~]# echo $JAVA_HOME
/usr/java/jdk
清理:ext里面的jar包
$JAVA_HOME/jre/lib/ext
这时重启启动resin 发现问题解决
估计是jre/lib/ext 里面的jar跟程序的jar发生了冲突。
RHEL5默认安装的vsftpd,使用系统关联的用户帐户登录,提示没有目录权限。
cannot change directory:/home/***
ftp服务器连接失败,错误提示:
500 OOPS: cannot change directory:/home/*******
500 OOPS: child died
开始以为是防火墙的问题,把iptables关掉后还是报这样的错误。
搜索了一下,发现是selinux的问题。
以下是解决方法:
1、修改 /etc/selinux/config
SELINUX = disabled
把SELINUX禁掉就可以了




