The NoteBook of EricKong

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            611 Posts :: 1 Stories :: 190 Comments :: 0 Trackbacks

          #

          1)最簡單的獲取本機的機器名
          [java] view plaincopy
          import java.net.InetAddress;  
          import java.net.UnknownHostException;  
            
          public class GetInfo {    
                
              public static void main(String[] args) throws UnknownHostException {  
                   InetAddress s = InetAddress.getLocalHost();  
                   System.out.println(s.getHostName());  
              }  
            
          }  
          輸入結(jié)果:
          PC-201012262159
          2)獲取Java環(huán)境信息和操作系統(tǒng)環(huán)境信息
          [java] view plaincopy
          import java.util.*;  
            
          public class GetInfo {    
                
              public static void main(String[] args) {  
                  Properties props = System.getProperties();  
                  System.out.println("Java的運行環(huán)境版本:" + props.getProperty("java.version"));  
                  System.out.println("Java的運行環(huán)境供應(yīng)商:" + props.getProperty("java.vendor"));  
                  System.out.println("Java供應(yīng)商的URL:"+ props.getProperty("java.vendor.url"));  
                  System.out.println("Java的安裝路徑:" + props.getProperty("java.home"));  
                  System.out.println("Java的虛擬機規(guī)范版本:"+ props.getProperty("java.vm.specification.version"));  
                  System.out.println("Java的虛擬機規(guī)范供應(yīng)商:" + props.getProperty("java.vm.specification.vendor"));  
                  System.out.println("Java的虛擬機規(guī)范名稱:"+ props.getProperty("java.vm.specification.name"));  
                  System.out.println("Java的虛擬機實現(xiàn)版本:"+ props.getProperty("java.vm.version"));  
                  System.out.println("Java的虛擬機實現(xiàn)供應(yīng)商:" + props.getProperty("java.vm.vendor"));  
                  System.out.println("Java的虛擬機實現(xiàn)名稱:" + props.getProperty("java.vm.name"));  
                  System.out.println("Java運行時環(huán)境規(guī)范版本:" + props.getProperty("java.specification.version"));  
                  System.out.println("Java運行時環(huán)境規(guī)范供應(yīng)商:"+ props.getProperty("java.specification.vender"));  
                  System.out.println("Java運行時環(huán)境規(guī)范名稱:" + props.getProperty("java.specification.name"));  
                  System.out.println("Java的類格式版本號:"+ props.getProperty("java.class.version"));  
                  System.out.println("Java的類路徑:" + props.getProperty("java.class.path"));  
                  System.out.println("加載庫時搜索的路徑列表:"   + props.getProperty("java.library.path"));  
                  System.out.println("默認的臨時文件路徑:" + props.getProperty("java.io.tmpdir"));  
                  System.out.println("一個或多個擴展目錄的路徑:" + props.getProperty("java.ext.dirs"));  
                  System.out.println("操作系統(tǒng)的名稱:" + props.getProperty("os.name"));  
                  System.out.println("操作系統(tǒng)的構(gòu)架:" + props.getProperty("os.arch"));  
                  System.out.println("操作系統(tǒng)的版本:" + props.getProperty("os.version"));  
                  System.out.println("文件分隔符:" + props.getProperty("file.separator"));  //在 unix 系統(tǒng)中是"/"  
                  System.out.println("路徑分隔符:" + props.getProperty("path.separator")); // 在 unix 系統(tǒng)中是":"  
                  System.out.println("行分隔符:" + props.getProperty("line.separator")); // 在 unix系統(tǒng)中是"/n"  
                  System.out.println("用戶的賬戶名稱:" + props.getProperty("user.name"));  
                  System.out.println("用戶的主目錄:" + props.getProperty("user.home"));  
                  System.out.println("用戶的當(dāng)前工作目錄:" + props.getProperty("user.dir"));  
              }  
            
          }  
          輸出結(jié)果:
          Java的運行環(huán)境版本:1.6.0_13
          Java的運行環(huán)境供應(yīng)商:Sun Microsystems Inc.
          Java供應(yīng)商的URL:http://java.sun.com/
          Java的安裝路徑:D:\Program Files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre
          Java的虛擬機規(guī)范版本:1.0
          Java的虛擬機規(guī)范供應(yīng)商:Sun Microsystems Inc.
          Java的虛擬機規(guī)范名稱:Java Virtual Machine Specification
          Java的虛擬機實現(xiàn)版本:11.3-b02
          Java的虛擬機實現(xiàn)供應(yīng)商:Sun Microsystems Inc.
          Java的虛擬機實現(xiàn)名稱:Java HotSpot(TM) Client VM
          Java運行時環(huán)境規(guī)范版本:1.6
          Java運行時環(huán)境規(guī)范供應(yīng)商:null
          Java運行時環(huán)境規(guī)范名稱:Java Platform API Specification
          Java的類格式版本號:50.0
          Java的類路徑:C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Authentication\WEB-INF\classes;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\core\org.springframework.core-3.0.1.RELEASE-A.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\core\org.springframework.context-3.0.1.RELEASE-A.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\core\org.springframework.beans-3.0.1.RELEASE-A.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\core\org.springframework.asm-3.0.1.RELEASE-A.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\core\com.springsource.org.apache.log4j-1.2.15.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\core\com.springsource.org.apache.commons.logging-1.1.1.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\core\org.springframework.expression-3.0.1.RELEASE-A.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\persistJdbc\com.springsource.com.mchange.v2.c3p0-0.9.1.2.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\persistJdbc\commons-dbcp.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\persistJdbc\com.springsource.org.apache.commons.pool-1.5.3.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\persistJdbc\jotm.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\persistJdbc\xapool.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\persistJdbc\com.springsource.org.apache.commons.lang-2.4.0.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\persistCore\persistence.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\persistCore\org.springframework.jdbc-3.0.1.RELEASE-A.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\persistCore\org.springframework.orm-3.0.1.RELEASE-A.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\persistCore\org.springframework.transaction-3.0.1.RELEASE-A.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\aop\org.springframework.aop-3.0.1.RELEASE-A.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\aop\com.springsource.org.aopalliance-1.0.0.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\aop\com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\aop\com.springsource.net.sf.cglib-2.2.0.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\aop\org.springframework.aspects-3.0.1.RELEASE-A.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\aop\org.springframework.instrument-3.0.1.RELEASE-A.jar;D:\Program Files\Genuitec\MyEclipse 8.5\configuration\org.eclipse.osgi\bundles\87\1\.cp\data\3.0\lib\aop\org.springframework.instrument.tomcat-3.0.1.RELEASE-A.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.ws.xfire_8.5.0.me201003052220\lib\webservices-api.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.ws.xfire_8.5.0.me201003052220\lib\webservices-extra-api.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.ws.xfire_8.5.0.me201003052220\lib\webservices-extra.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.ws.xfire_8.5.0.me201003052220\lib\webservices-rt.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.5.0.me201003231033\data\libraryset\1.4\activation.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.5.0.me201003231033\data\libraryset\1.4\javax.servlet.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.5.0.me201003231033\data\libraryset\1.4\javax.servlet.jsp.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.5.0.me201003231033\data\libraryset\1.4\jboss-j2ee.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.5.0.me201003231033\data\libraryset\1.4\jboss-jaxrpc.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.5.0.me201003231033\data\libraryset\1.4\jboss-jsr77.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.5.0.me201003231033\data\libraryset\1.4\jboss-saaj.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.5.0.me201003231033\data\libraryset\1.4\mail.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.5.0.me201003231033\data\libraryset\1.4\namespace.jar;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.5.0.me201003231033\data\libraryset\1.4\xml-apis.jar;C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Authentication\WEB-INF\lib\commons-codec-1.4.jar;C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Authentication\WEB-INF\lib\commons-lang-2.4.jar;C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Authentication\WEB-INF\lib\dom4j-1.6.1.jar;C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Authentication\WEB-INF\lib\log4j-1.2.14.jar;C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Authentication\WEB-INF\lib\commons-io-1.4.jar;C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Authentication\WEB-INF\lib\jaxen-1.1.1.jar;C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Authentication\WEB-INF\lib\ojdbc14.jar;C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Authentication\WEB-INF\lib\commons-httpclient-3.1.jar
          加載庫時搜索的路徑列表:D:\Program Files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:/Program Files/Genuitec/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin/client;D:/Program Files/Genuitec/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin;C:\Program Files\Common Files\NetSarang;F:\oracle\product\10.2.0\db_1\bin;;d:\Program Files\XMedia\tools\miscc:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.1.8\bin;D:\Android\android-sdk-windows\tools;D:\Program Files\TortoiseSVN\bin;C:\Program Files\Intel\WiFi\bin\;D:\Program Files\Java\jrockit-jdk1.6.0_22-R28.1.1-4.0.1\bin;c:\oracle\ora92\bin;""C:\Program Files\Oracle\jre\1.1.8\bin";"";"
          默認的臨時文件路徑:C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\
          一個或多個擴展目錄的路徑:D:\Program Files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
          操作系統(tǒng)的名稱:Windows XP
          操作系統(tǒng)的構(gòu)架:x86
          操作系統(tǒng)的版本:5.1
          文件分隔符:\
          路徑分隔符:;
          行分隔符:
          用戶的賬戶名稱:Administrator
          用戶的主目錄:C:\Documents and Settings\Administrator
          用戶的當(dāng)前工作目錄:C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\Authentication
          3)獲取本機MAC地址和實時IP地址
          [java] view plaincopy
          import java.net.InetAddress;  
          import java.net.NetworkInterface;  
          import java.net.SocketException;  
          import java.net.UnknownHostException;  
          import java.util.Formatter;  
          import java.util.Locale;  
            
          public class GetInfo {    
                
              public static void main(String[] args) throws UnknownHostException, SocketException {  
                  InetAddress address = InetAddress.getLocalHost();  
                  NetworkInterface ni = NetworkInterface.getByInetAddress(address);  
                  ni.getInetAddresses().nextElement().getAddress();  
                  byte[] mac = ni.getHardwareAddress();  
                  String sIP = address.getHostAddress();  
                  String sMAC = "";  
                  Formatter formatter = new Formatter();  
                  for (int i = 0; i < mac.length; i++) {  
                      sMAC = formatter.format(Locale.getDefault(), "%02X%s", mac[i],  
                              (i < mac.length - 1) ? "-" : "").toString();  
                  }  
                  System.out.println("IP:" + sIP);  
                  System.out.println("MAC:" + sMAC);  
              }  
            
          }  
          輸出結(jié)果:
          IP:10.192.33.64
          MAC:00-21-86-58-39-C6
          4)獲取本機用戶名、計算機名、計算機域名
          [java] view plaincopy
          import java.util.Map;  
            
          public class GetInfo {    
                
              public static void main(String[] args) {  
                  Map<String, String> map = System.getenv();  
                    String userName = map.get("USERNAME");// 獲取用戶名  
                    String computerName = map.get("COMPUTERNAME");// 獲取計算機名  
                    String userDomain = map.get("USERDOMAIN");// 獲取計算機域名  
                    System.out.println(userName);  
                    System.out.println(computerName);  
                    System.out.println(userDomain);  
              }  
            
          }  
          使用自帶的System.getenv()方法獲得一個Map
          輸出結(jié)果:
          Administrator
          PC-201012262159
          PC-201012262159
          5)獲取本機的實時IP、計算機名、操作系統(tǒng)名、操作系統(tǒng)版本
          [java] view plaincopy
          import java.net.InetAddress;  
          import java.net.UnknownHostException;  
          import java.util.Properties;  
            
          public class GetInfo {    
                
              public static void main(String[] args) throws UnknownHostException {  
                  InetAddress addr = InetAddress.getLocalHost();    
                  String ip=addr.getHostAddress().toString(); //獲取本機ip  
                  String hostName=addr.getHostName().toString(); //獲取本機計算機名稱  
                  System.out.println("本機IP:"+ip+"\n本機名稱:"+hostName);  
                  Properties props1=System.getProperties();   
                  System.out.println("操作系統(tǒng)的名稱:"+props1.getProperty("os.name"));   
                  System.out.println("操作系統(tǒng)的版本:"+props1.getProperty("os.version"));    
              }  
            
          }  
          輸出結(jié)果:
          本機IP:10.192.33.64
          本機名稱:PC-201012262159
          操作系統(tǒng)的名稱:Windows XP
          操作系統(tǒng)的版本:5.1
          posted @ 2013-11-28 16:22 Eric_jiang 閱讀(330) | 評論 (0)編輯 收藏

          1:request.getRequestDispatcher("轉(zhuǎn)發(fā)路徑").forward(req,resp)該語句是實現(xiàn)請求轉(zhuǎn)發(fā)的,當(dāng)請求進入到該servlet中執(zhí)行到該語句時,服務(wù)器不會直接響應(yīng)而是轉(zhuǎn)發(fā)到轉(zhuǎn)發(fā)路徑得servlet繼續(xù)處理,由于將req和resp帶過去了,所以這期間是沒有重新創(chuàng)建request和response對象,所以在接下來的servlet中同樣可以獲得當(dāng)前servlet的request中的參數(shù)。
          2:response.sendRedirect("")當(dāng)運行到servlet的該條語句時,服務(wù)器會響應(yīng)瀏覽器一個小心頭告訴瀏覽器重新請求方法中的路徑對應(yīng)的servlet,因為是瀏覽器從新請求所以會創(chuàng)建新的request和response對象,因此上一次請求的request中的參數(shù)無法得到。
          很好的理解這兩者的原理和區(qū)別有助于熟練操作請求的轉(zhuǎn)發(fā)和重定向。熟練的控制參數(shù)獲取。 
          posted @ 2013-11-28 14:36 Eric_jiang 閱讀(302) | 評論 (0)編輯 收藏

          1.確定DSN

          LOGON TSO->SD.DA->PRE CANSDSST->JESJCL->F RKANPARU

          會看到如下內(nèi)容:

          ... DISP=SHR, DSN=**.**.RKANPARU(**)

          這就是需要查到的DSN

          2.查看需要確定IP地址的LPAR的DS的KDSENV

          可以看到以下內(nèi)容:

          KDEB_INTERFACELIST=**, **即為IP地址

          posted @ 2013-11-25 14:59 Eric_jiang 閱讀(455) | 評論 (0)編輯 收藏



          今天介紹下VM8下安裝Mac OS X 10.7


          1、工具篇

          下載Vmware Workstation 8.0正式版http://115.com/file/bhyk1l2u#

          Vmware8.0 漢化包http://115.com/file/dn38a7eu#

          (因為我的電腦要經(jīng)常上網(wǎng)銀什么的所以為了安全直起簽我沒有裝漢化包,用的是原版英文版!但我測試過此漢化包)


          下載Mac OS X  10.7 安裝包http://115.com/file/clj1iu8m#

          下載HJMac http://115.com/file/cljyu1rh#  (使用說明在后面)

          下載Mac OS X  10.7 .2 離線升級包    http://115.com/file/cly2xggh#

          (可能這個離線升級包不一定要用我這個有時間的朋友可以自己去網(wǎng)上找來測試下,升級方法在后面!)

          2、虛擬機安裝

          這個安裝很簡單的,直接一路Next 到最后就可以了!這個應(yīng)該可以略過啦...

          3、虛擬機設(shè)置

          安裝完以后點桌面的VMware Workstation圖標(biāo)打開,開始創(chuàng)建虛擬機。

          創(chuàng)建虛擬機,基本都下一步就可以很簡單的。虛擬機型號要選FreeBSD X 64,

          CPU最好要設(shè)雙核,內(nèi)存2G以上, 硬盤不小于30G這  樣基本上搞定了。
           






















          到這里虛擬機 設(shè)置好一切準(zhǔn)備就緒

           

          接下來就開始安裝系統(tǒng)



























           

          至此整個安裝過程基本算是完成了

          posted @ 2013-11-21 14:25 Eric_jiang 閱讀(476) | 評論 (0)編輯 收藏

          linux中df命令的功能是用來檢查linux服務(wù)器的文件系統(tǒng)的磁盤空間占用情況。可以利用該命令來獲取硬盤被占用了多少空間,目前還剩下多少空間等信息。
          1.命令格式:
          df [選項] [文件]
          2.命令功能:
          顯示指定磁盤文件的可用空間。如果沒有文件名被指定,則所有當(dāng)前被掛載的文件系統(tǒng)的可用空間將被顯示。默認情況下,磁盤空間將以 1KB 為單位進行顯示,除非環(huán)境變量 POSIXLY_CORRECT 被指定,那樣將以512字節(jié)為單位進行顯示
          3.命令參數(shù):
          必要參數(shù):
          -a 全部文件系統(tǒng)列表
          -h 方便閱讀方式顯示
          -H 等于“-h”,但是計算式,1K=1000,而不是1K=1024
          -i 顯示inode信息
          -k 區(qū)塊為1024字節(jié)
          -l 只顯示本地文件系統(tǒng)
          -m 區(qū)塊為1048576字節(jié)
          --no-sync 忽略 sync 命令
          -P 輸出格式為POSIX
          --sync 在取得磁盤信息前,先執(zhí)行sync命令
          -T 文件系統(tǒng)類型
          選擇參數(shù):
          --block-size=<區(qū)塊大小> 指定區(qū)塊大小
          -t<文件系統(tǒng)類型> 只顯示選定文件系統(tǒng)的磁盤信息
          -x<文件系統(tǒng)類型> 不顯示選定文件系統(tǒng)的磁盤信息
          --help 顯示幫助信息
          --version 顯示版本信息
          4.使用實例:
          實例1:顯示磁盤使用情況
          命令:
          df
          輸出:
          [root@CT1190 log]# df
          文件系統(tǒng)               1K-塊        已用     可用 已用% 掛載點
          /dev/sda7             19840892    890896  17925856   5% /
          /dev/sda9            203727156 112797500  80413912  59% /opt
          /dev/sda8              4956284    570080   4130372  13% /var
          /dev/sda6             19840892   1977568  16839184  11% /usr
          /dev/sda3               988116     23880    913232   3% /boot
          tmpfs                 16473212         0  16473212   0% /dev/shm
          說明:
          linux中df命令的輸出清單的第1列是代表文件系統(tǒng)對應(yīng)的設(shè)備文件的路徑名(一般是硬盤上的分區(qū));第2列給出分區(qū)包含的數(shù)據(jù)塊(1024字節(jié))的數(shù)目;第3,4列分別表示已用的和可用的數(shù)據(jù)塊數(shù)目。用戶也許會感到奇怪的是,第3,4列塊數(shù)之和不等于第2列中的塊數(shù)。這是因為缺省的每個分區(qū)都留了少量空間供系統(tǒng)管理員使用。即使遇到普通用戶空間已滿的情況,管理員仍能登錄和留有解決問題所需的工作空間。清單中Use% 列表示普通用戶空間使用的百分比,即使這一數(shù)字達到100%,分區(qū)仍然留有系統(tǒng)管理員使用的空間。最后,Mounted on列表示文件系統(tǒng)的掛載點。
          實例2:以inode模式來顯示磁盤使用情況
          命令:
          df -i
          輸出:
          [root@CT1190 log]# df -i
          文件系統(tǒng)               Inode (I)已用 (I)可用 (I)已用% 掛載點
          /dev/sda7            5124480    5560 5118920    1% /
          /dev/sda9            52592640   50519 52542121    1% /opt
          /dev/sda8            1280000    8799 1271201    1% /var
          /dev/sda6            5124480   80163 5044317    2% /usr
          /dev/sda3             255232      34  255198    1% /boot
          tmpfs                4118303       1 4118302    1% /dev/shm
          說明:
          實例3:顯示指定類型磁盤
          命令:
          df -t ext3
          輸出:
          [root@CT1190 log]# df -t ext3
          文件系統(tǒng)               1K-塊        已用     可用 已用% 掛載點
          /dev/sda7             19840892    890896  17925856   5% /
          /dev/sda9            203727156  93089700 100121712  49% /opt
          /dev/sda8              4956284    570104   4130348  13% /var
          /dev/sda6             19840892   1977568  16839184  11% /usr
          /dev/sda3               988116     23880    913232   3% /boot
          說明:
          實例4:列出各文件系統(tǒng)的i節(jié)點使用情況
          命令:
          df -ia
          輸出:
          [root@CT1190 log]# df -ia
          文件系統(tǒng)               Inode (I)已用 (I)可用 (I)已用% 掛載點
          /dev/sda7            5124480    5560 5118920    1% 
          /proc                       0       0       0    -  /proc
          sysfs                      0       0       0    -  /sys
          devpts                     0       0       0    -  /dev/pts
          /dev/sda9            52592640   50519 52542121    1% /opt
          /dev/sda8            1280000    8799 1271201    1% /var
          /dev/sda6            5124480   80163 5044317    2% /usr
          /dev/sda3             255232      34  255198    1% /boot
          tmpfs                4118303       1 4118302    1% /dev/shm
          none                       0       0       0    -  /proc/sys/fs/binfmt_misc
          說明:
          實例5:列出文件系統(tǒng)的類型
          命令:
          df -T
          輸出:
          root@CT1190 log]# df -T
          文件系統(tǒng)      類型     1K-塊        已用     可用 已用% 掛載點
          /dev/sda7     ext3    19840892    890896  17925856   5% /
          /dev/sda9     ext3   203727156  93175692 100035720  49% /opt
          /dev/sda8     ext3     4956284    570104   4130348  13% /var
          /dev/sda6     ext3    19840892   1977568  16839184  11% /usr
          /dev/sda3     ext3      988116     23880    913232   3% /boot
          tmpfs        tmpfs    16473212         0  16473212   0% /dev/shm
          說明:
          實例6:以更易讀的方式顯示目前磁盤空間和使用情況 
          命令:
          輸出:
          [root@CT1190 log]# df -h
          文件系統(tǒng)              容量  已用 可用 已用% 掛載點
          /dev/sda7              19G  871M   18G   5% /
          /dev/sda9             195G   89G   96G  49% /opt
          /dev/sda8             4.8G  557M  4.0G  13% /var
          /dev/sda6              19G  1.9G   17G  11% /usr
          /dev/sda3             965M   24M  892M   3% /boot
          tmpfs                  16G     0   16G   0% /dev/shm
          [root@CT1190 log]# df -H
          文件系統(tǒng)               容量   已用  可用 已用% 掛載點
          /dev/sda7               21G   913M    19G   5% /
          /dev/sda9              209G    96G   103G  49% /opt
          /dev/sda8              5.1G   584M   4.3G  13% /var
          /dev/sda6               21G   2.1G    18G  11% /usr
          /dev/sda3              1.1G    25M   936M   3% /boot
          tmpfs                   17G      0    17G   0% /dev/shm
          [root@CT1190 log]# df -lh
          文件系統(tǒng)              容量  已用 可用 已用% 掛載點
          /dev/sda7              19G  871M   18G   5% /
          /dev/sda9             195G   89G   96G  49% /opt
          /dev/sda8             4.8G  557M  4.0G  13% /var
          /dev/sda6              19G  1.9G   17G  11% /usr
          /dev/sda3             965M   24M  892M   3% /boot
          tmpfs                  16G     0   16G   0% /dev/shm
          [root@CT1190 log]# df -k
          文件系統(tǒng)               1K-塊        已用     可用 已用% 掛載點
          /dev/sda7             19840892    890896  17925856   5% /
          /dev/sda9            203727156  93292572  99918840  49% /opt
          /dev/sda8              4956284    570188   4130264  13% /var
          /dev/sda6             19840892   1977568  16839184  11% /usr
          /dev/sda3               988116     23880    913232   3% /boot
          tmpfs                 16473212         0  16473212   0% /dev/shm
          說明:
          -h更具目前磁盤空間和使用情況 以更易讀的方式顯示
          -H根上面的-h參數(shù)相同,不過在根式化的時候,采用1000而不是1024進行容量轉(zhuǎn)換
          -k以單位顯示磁盤的使用情況
          -l顯示本地的分區(qū)的磁盤空間使用率,如果服務(wù)器nfs了遠程服務(wù)器的磁盤,那么在df上加上-l后系統(tǒng)顯示的是過濾nsf驅(qū)動器后的結(jié)果
          -i顯示inode的使用情況。linux采用了類似指針的方式管理磁盤空間影射.這也是一個比較關(guān)鍵應(yīng)用
          posted @ 2013-11-17 21:26 Eric_jiang 閱讀(308) | 評論 (0)編輯 收藏

          chown將指定文件的擁有者改為指定的用戶或組,用戶可以是用戶名或者用戶ID;組可以是組名或者組ID;文件是以空格分開的要改變權(quán)限的文件列表,支持通配符。系統(tǒng)管理員經(jīng)常使用chown命令,在將文件拷貝到另一個用戶的名錄下之后,讓用戶擁有使用該文件的權(quán)限。 

            1.命令格式:

              chown [選項]... [所有者][:[組]] 文件...

            2.命令功能:

              通過chown改變文件的擁有者和群組。在更改文件的所有者或所屬群組時,可以使用用戶名稱和用戶識別碼設(shè)置。普通用戶不能將自己的文件改變成其他的擁有者。其操作權(quán)限一般為管理員。

            3.命令參數(shù):

            必要參數(shù):

              -c 顯示更改的部分的信息

              -f 忽略錯誤信息

              -h 修復(fù)符號鏈接

              -R 處理指定目錄以及其子目錄下的所有文件

              -v 顯示詳細的處理信息

              -deference 作用于符號鏈接的指向,而不是鏈接文件本身

            選擇參數(shù):

              --reference=<目錄或文件> 把指定的目錄/文件作為參考,把操作的文件/目錄設(shè)置成參考文件/目錄相同擁有者和群組

              --from=<當(dāng)前用戶:當(dāng)前群組> 只有當(dāng)前用戶和群組跟指定的用戶和群組相同時才進行改變

              --help 顯示幫助信息

              --version 顯示版本信息

            4.使用實例:

            實例1:改變擁有者和群組

            命令:

              chown mail:mail log2012.log

            輸出:  


          [root@localhost test6]# ll
          ---xr--r-- 1 root users 302108 11-30 08:39 linklog.log
          ---xr--r-- 1 root users 302108 11-30 08:39 log2012.log
          -rw-r--r-- 1 root users     61 11-30 08:39 log2013.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2014.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2015.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2016.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2017.log
          [root@localhost test6]# chown mail:mail log2012.log 
          [root@localhost test6]# ll
          ---xr--r-- 1 root users 302108 11-30 08:39 linklog.log
          ---xr--r-- 1 mail mail  302108 11-30 08:39 log2012.log
          -rw-r--r-- 1 root users     61 11-30 08:39 log2013.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2014.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2015.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2016.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2017.log
          [root@localhost test6]#

            說明:

            實例2:改變文件擁有者和群組

            命令:

              chown root: log2012.log

            輸出:    


          [root@localhost test6]# ll
          總計 604
          ---xr--r-- 1 root users 302108 11-30 08:39 linklog.log
          ---xr--r-- 1 mail mail  302108 11-30 08:39 log2012.log
          -rw-r--r-- 1 root users     61 11-30 08:39 log2013.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2014.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2015.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2016.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2017.log
          [root@localhost test6]# chown root: log2012.log 
          [root@localhost test6]# ll
          總計 604
          ---xr--r-- 1 root users 302108 11-30 08:39 linklog.log
          ---xr--r-- 1 root root  302108 11-30 08:39 log2012.log
          -rw-r--r-- 1 root users     61 11-30 08:39 log2013.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2014.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2015.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2016.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2017.log
          [root@localhost test6]#

            說明:

            實例3:改變文件群組

            命令:

              chown :mail log2012.log

            輸出:  


          [root@localhost test6]# ll
          總計 604
          ---xr--r-- 1 root users 302108 11-30 08:39 linklog.log
          ---xr--r-- 1 root root  302108 11-30 08:39 log2012.log
          -rw-r--r-- 1 root users     61 11-30 08:39 log2013.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2014.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2015.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2016.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2017.log
          [root@localhost test6]# chown :mail log2012.log 
          [root@localhost test6]# ll
          總計 604
          ---xr--r-- 1 root users 302108 11-30 08:39 linklog.log
          ---xr--r-- 1 root mail  302108 11-30 08:39 log2012.log
          -rw-r--r-- 1 root users     61 11-30 08:39 log2013.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2014.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2015.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2016.log
          -rw-r--r-- 1 root users      0 11-30 08:39 log2017.log

            說明:

            實例4:改變指定目錄以及其子目錄下的所有文件的擁有者和群組 

            命令:

              chown -R -v root:mail test6

            輸出:  


          [root@localhost test]# ll
          drwxr-xr-x 2 root users   4096 11-30 08:39 test6
          [root@localhost test]# chown -R -v root:mail test6
          “test6/log2014.log” 的所有者已更改為 root:mail
          “test6/linklog.log” 的所有者已更改為 root:mail
          “test6/log2015.log” 的所有者已更改為 root:mail
          “test6/log2013.log” 的所有者已更改為 root:mail
          “test6/log2012.log” 的所有者已保留為 root:mail
          “test6/log2017.log” 的所有者已更改為 root:mail
          “test6/log2016.log” 的所有者已更改為 root:mail
          “test6” 的所有者已更改為 root:mail
          [root@localhost test]# ll
          drwxr-xr-x 2 root mail   4096 11-30 08:39 test6
          [root@localhost test]# cd test6
          [root@localhost test6]# ll
          總計 604
          ---xr--r-- 1 root mail 302108 11-30 08:39 linklog.log
          ---xr--r-- 1 root mail 302108 11-30 08:39 log2012.log
          -rw-r--r-- 1 root mail     61 11-30 08:39 log2013.log
          -rw-r--r-- 1 root mail      0 11-30 08:39 log2014.log
          -rw-r--r-- 1 root mail      0 11-30 08:39 log2015.log
          -rw-r--r-- 1 root mail      0 11-30 08:39 log2016.log
          -rw-r--r-- 1 root mail      0 11-30 08:39 log2017.log

          posted @ 2013-11-17 21:21 Eric_jiang 閱讀(188) | 評論 (0)編輯 收藏

          故障現(xiàn)象:

           

          Telnet或者Pcom軟件顯示登陸界面太慢

           

          適用系統(tǒng)版本: V4R4  V4R5

           

          對于V4R4或者V4R5系統(tǒng),我們通過telnet客戶端登陸AS/400的時候,經(jīng)常會很久才能顯示signon登陸界面,但是一旦signon界面出來后,接著的交互式操作相應(yīng)速度都很正常。

           
          負責(zé)Telnet登陸的初始程序是QTVDEVICE, 該作業(yè)的默認運行級別是50。雖然該作業(yè)在絕大多數(shù)系統(tǒng)上運行的挺好,但是,在一些擁有大量的批處理左右的系統(tǒng)中,作業(yè)QTVDEVICE會同批處理作業(yè)去搶占CPU資源,從而影響了signon屏幕的相應(yīng)。


          解決這個問題的方法,通常是增加QTVDEVICE 作業(yè)的運行優(yōu)先級到20

          如果你打了補丁 SF62558 (V4R4) 或者 SF62559 (V4R5) ,或者更高的補丁版本,這些補丁會調(diào)整該作業(yè)的運行優(yōu)先級到20

           

          使用下面的步驟命令來調(diào)整運行優(yōu)先級路由條目到20

          ADDRTGE SBSD(QSYS/QSYSWRK) SEQNBR(2517) CMPVAL('TELNETD' 1)
          PGM(QSYS/QCMD) CLS(QSYS/QSYSCLS20)
          -
          如果PTF沒有應(yīng)用,使用下面的命令改變優(yōu)先級路由條目到20

          ADDRTGE SBSD(QSYS/QSYSWRK) SEQNBR(2517) CMPVAL('QCMDI' 1)
          PGM(QSYS/QCMD) CLS(QSYS/QSYSCLS20)
          -
          注意: Telnet服務(wù)和QTVDEVICE作業(yè)必須結(jié)束,系統(tǒng)重啟后,優(yōu)先級才能改變。
          -
          Additional Information:
          -
          Previous to the PTFs being applied the QTVDEVICE jobs are submitted with a compare value of QCMDI.  If the performance issues occurred, the circumvention noted above was to add a Routing Entry with a compare value for QCMDI that will reference a Class with a higher run priority.  A drawback to this is that other jobs, the Pass-through server for example, are submitted to the QSYSWRK subsystem with a compare value of QCMDI.  So the QCMDI Routing Entry affected more than just Telnet.
          -
          Mindful of the potential side effects of the first circumvention, a unique compare value of TELNETD was added to the QTVDEVICE job submission via PTF.  This allows the run priority of the Telnet QTVDEVICE jobs to be changed without affecting any other programs.  A real consideration with these PTFs, which are on the current Cumulative Packages, is that if you previously had added the QCMDI Routing Entry to address this issue, and the new Routing Entry is not added, the same performance lags that were experienced before will reappear.
          -
          If you had previously added the QCMDI Routing Entry at sequence number 2517, the recommendation is to remove that Routing Entry and add the one for TELNETD at sequence number 2517.  Because in future releases of OS/400 the install of TCP/IP Connectivity Utilities will add the Routing Entry for TELNETD at sequence number 2517.  If you still want jobs that are submitted to the QSYSWRK subsystem with a compare value of QCMDI to run at a priority other than 50, then add that Routing Entry back at any
          available sequence number.
          -
          For tuning the System performance further, the run priority can be customized by replacing the QSYSCLS20 class with a different class, either system provided or user created, that references a different run priority.  And with the new PTFs applied, that change will only affect the Telnet server jobs.  

          posted @ 2013-11-11 14:29 Eric_jiang 閱讀(576) | 評論 (0)編輯 收藏

          產(chǎn)品: OS/400,i5/OS
          平臺: i5,iSeries, AS/400 
          版本: V5RxMx
          問題
          如何發(fā)現(xiàn)哪些OS/400系統(tǒng)值被修改了,什么時候被哪個用戶修改的?
          解答
          每次一個OS/400系統(tǒng)值被修改,系統(tǒng)會自動向歷史日志(QHST)寫入一條信息:CPF1805, CPF1806, CPF1815 或 CPF1823 ;如果系統(tǒng)無法確認這次系統(tǒng)值的修改是否成功,還會向歷史日志(QHST)再寫入一些信息,如 CPF1807, CPF1808 或 CPF1824。
          請用如下方法來定位在特定時間里是否有這些信息產(chǎn)生了:
          (1)DSPLOG + F4 + F10 調(diào)出所有參數(shù),填寫希望查看的時間段
          (2)注意最后一頁的參數(shù)"MSGID",請?zhí)钊?CPF1805, CPF1806, CPF1807, CPF1808, CPF1815, CPF1823, CPF1824"
          (3)在所有列出的信息里,如果想進一步了解某條信息,把光標(biāo)定在這條信息下,按F1查看附加信息;再按F9查看詳細信息,可知是哪個作業(yè)更改的這個系統(tǒng)值
          posted @ 2013-11-11 14:21 Eric_jiang 閱讀(460) | 評論 (0)編輯 收藏

               摘要: 配置通過IE來訪問AS/400 5250界面 很多剛開始接觸AS/400的用戶很不習(xí)慣AS/400傳統(tǒng)的5250黑屏界面。下面我們介紹如何通過IE來訪問AS/400的5250界面。 要實現(xiàn)這個功能需要啟用AS/400的WSG服務(wù)。 WSG是一個包含在IC/400內(nèi)部的后臺精靈程序,WSG能夠自動地將送往特定TCP/IP端口(port,目前一般為5061)的5...  閱讀全文
          posted @ 2013-11-11 14:06 Eric_jiang 閱讀(711) | 評論 (0)編輯 收藏

          簡介

          輕量級目錄訪問協(xié)議 (Lightweight Directory Access Protocol,LDAP) 是一個輕量級的客戶機-服務(wù)器協(xié)議,用于訪問目錄服務(wù),尤其是那些基于 X.500 的服務(wù)。IBM Directory Server 是一個實現(xiàn) LDAP 協(xié)議的成熟產(chǎn)品。近來流行的 Linux 提供了一些系統(tǒng)用戶驗證方法,包括本地文件、NIS、LDAP 和 PAM 機制。Linux 可以為不同的服務(wù)使用不同的驗證方法。

          本文介紹了如何使用 IBM Directory Server 進行 Linux 用戶驗證。我沒有在文中介紹相關(guān)的概念; 參考資料 中有相關(guān)的背景資料。

          我要管理的 Linux 系統(tǒng)為 RedHat Linux 7.3,LDAP 服務(wù)器是 IBM Directory Server 5.1。如果需要,請參考 RedHat 和 IBM 的網(wǎng)站提供的 Linux 和 Directory Server 5.1 安裝說明。




          配置 Directory Server 5.1 服務(wù)器

          在使用 Directory Server 來存儲您的 Linux 系統(tǒng)用戶信息之前,您需要先計劃您的系統(tǒng)用戶結(jié)構(gòu)。例如,我將 Directory Server 5.1 服務(wù)器安裝在一個單獨的 Windows 2000 服務(wù)器上,計劃了如下的系統(tǒng)用戶結(jié)構(gòu):

          o=ibm,c=cn
          |-ou=csdl,o=ibm,c=cn
          |-ou=gcl,ou=csdl,o=ibm,c=cn
          |-uid=user1,ou=gcl,ou=csdl,o=ibm,c=cn
          |-uid=user2,ou=gcl,ou=csdl,o=ibm,c=cn




          使用以下步驟來構(gòu)建這個結(jié)構(gòu):

          添加后綴。停止 Directory Server 服務(wù)器,然后使用 ldapxcfg 添加一個新的后綴: o=ibm,c=cn ,參見 圖 1
          圖 1. 添加一個新后綴




          Click here to open new window

          導(dǎo)入 LDAP Data Interchange Format (LDIF) 文件,以及基本結(jié)構(gòu)。編輯 LDIF 文件,它定義了根專有名稱 (distinguished name,DN) 和基本結(jié)構(gòu) DN,如下所示。 version: 1

          dn: o=IBM,c=CN
          objectclass: top
          objectclass: organization
          o: ibm

          dn: ou=CSDL,o=ibm,c=cn
          ou: CSDL
          objectclass: organizationalUnit
          objectclass: top
          description: China Software Development Lab
          businessCategory: R&D

          dn: ou=GCL,ou=CSDL,o=ibm,c=cn
          ou: GCL
          objectclass: organizationalUnit
          objectclass: top
          description: Globalization Certification Lab




          使用 ldapxcfg 導(dǎo)入 LDIF,參見 圖 2。




          Click here to open new window

          使用 Web 工具 ldif2db 來添加用戶。創(chuàng)建一個新用戶條目有兩種不同的方法:
          Web 工具
          Directory Server 5.1 提供了一個 Web 應(yīng)用程序,可以部署到特定的應(yīng)用程序服務(wù)器上。它默認使用 WebSphere Application Server 5.0 express。這個工具為用戶提供了一個友好的界面來幫您管理 LDAP 信息。
          命令行工具
          使用 ldif2db 來導(dǎo)入條目。例如,
          ldif2db -i oneEntry.ldif
          下面的這個例子介紹了如何使用命令工具來添加一個新用戶。

          #oneEntry.ldif

          dn: uid=user1,ou=GCL,ou=CSDL,o=ibm,c=cn
          loginShell: /bin/bash
          memberUid: 900
          gidNumber: 800
          objectclass: posixGroup
          objectclass: top
          objectclass: posixAccount
          objectclass: shadowAccount
          uid: user1
          uidNumber: 900
          cn: user1
          description: One user of system
          homeDirectory: /home/user1
          userpassword: password
          ownerpropagate: TRUE
          entryowner: access-id:UID=USER1,OU=GCL,OU=CSDL,O=IBM,C=CN




          對于 Linux 用戶信息,對象類應(yīng)該是 posixAccount 。將本條目的 entryowner 設(shè)置為用戶“自己”,這樣用戶就可以修改密碼。要了解更多關(guān)于 Directory Server ACL 的信息,請閱讀 Directory Server 文檔。

          添加用戶完成后,啟動 Directory Server 服務(wù)器來開始為 Linux 用戶驗證服務(wù)。




          Linux 上的配置

          在 RedHat Linux 7.3 上,以 root 身份登錄,確保已經(jīng)安裝了以下兩個軟件包:

          openldap-2.0.23-4
          nss_ldap-185-1
          使用 #rpm -qa|grep ldap 命令來檢查已安裝的 RPM。如果沒有安裝這兩個軟件包,那么掛載 RedHat 安裝映像并執(zhí)行以下命令:
          #rpm -ivh /openldap-2.0.23-4.rpm
          #rpm -ivh /nss_ldap-185-1.rpm

          兩個軟件包安裝完成后,打開 /etc/ldap.conf 文件來做一些配置。下面是一些用于配置的關(guān)鍵指令。 host 指定 LDAP 服務(wù)器 IP/主機名
          base 指定 LDAP 客戶機搜索起點
          port 指定 LDAP 服務(wù)器端口
          pam_filter 指定 LDAP 客戶機搜索過濾器
          pam_login_attribute 指定一個用戶條目的登錄屬性
          pam_password 指定客戶機密碼哈希方法


          下面的例子是 ldap.conf 文件的部分內(nèi)容。尤其注意那些 加粗的指令。


          # @(#)$Id: ldap.conf,v 1.24 2001/09/20 14:12:26 lukeh Exp $
          #
          # This is the configuration file for the LDAP nameservice
          # switch library and the LDAP PAM module.
          #
          # PADL Software
          #
          http://www.padl.com
          #
          # Your LDAP server. Must be resolvable without using LDAP.
          #host 127.0.0.1

          host 192.168.0.188

          # The distinguished name of the search base.
          #base dc=example,dc=com

          base o=IBM,c=CN

          # Another way to specify your LDAP server is to provide an
          # uri with the server name. This allows to use
          # Unix Domain Sockets to connect to a local LDAP Server.
          #uri ldap://127.0.0.1/
          #uri ldaps://127.0.0.1/
          #uri ldapi://%2fvar%2frun%2fldapi_sock/
          # Note: %2f encodes the '/' used as directory separator
          # The LDAP version to use (defaults to 3
          # if supported by client library)
          #ldap_version 3

          # The distinguished name to bind to the server with.
          # Optional: default is to bind anonymously.
          #binddn cn=proxyuser,dc=example,dc=com

          # The credentials to bind with.
          # Optional: default is no credential.

          # The distinguished name to bind to the server with
          # if the effective user ID is root. Password is
          # stored in /etc/ldap.secret (mode 600)
          #rootbinddn cn=manager,dc=example,dc=com

          # The port.
          # Optional: default is 389.

          port 389

          # The search scope.
          #scope sub
          #scope one
          #scope base
          # Search timelimit
          #timelimit 30
          # Bind timelimit
          #bind_timelimit 30
          # Idle timelimit; client will close connections
          # (nss_ldap only) if the server has not been contacted
          # for the number of seconds specified below.
          #idle_timelimit 3600

          # Filter to AND with uid=%s

          pam_filter objectclass=posixAccount

          # The user ID attribute (defaults to uid)

          pam_login_attribute uid

          # Search the root DSE for the password policy (works
          # with Netscape Directory Server)
          #pam_lookup_policy yes
          # Check the 'host' attribute for access control
          # Default is no; if set to yes, and user has no
          # value for the host attribute, and pam_ldap is
          # configured for account management (authorization)
          # then the user will not be allowed to login.
          #pam_check_host_attr yes
          # Group to enforce membership of
          #pam_groupdn cn=PAM,ou=Groups,dc=example,dc=com
          # Group member attribute
          #pam_member_attribute uniquemember
          # Specify a minium or maximum UID number allowed
          #pam_min_uid 0
          #pam_max_uid 0
          # Template login attribute, default template user
          # (can be overriden by value of former attribute
          # in user's entry)
          #pam_login_attribute userPrincipalName
          #pam_template_login_attribute uid
          #pam_template_login nobody
          # HEADS UP: the pam_crypt, pam_nds_passwd,
          # and pam_ad_passwd options are no
          # longer supported.

          # Do not hash the password at all; presume
          # the directory server will do it, if
          # necessary. This is the default.
          #pam_password md5

          pam_password clear
          ssl no
          ...
          ...





          保存所作的修改,然后使用 authconfig 來啟用 LDAP 驗證,即執(zhí)行 #authconfig 。

          在 User Information Configuration 面板中,參見 圖 3,選中 Cache Information和 Use LDAP。


          圖 3. User Information Configuration




          Click here to open new window

          在 Authentication Configuration 面板中,選中 Use LDAP Authentication,參見 圖 4。


          圖 4. Authentication Configuration




          Click here to open new window

          然后輸入 Ok。Linux 系統(tǒng)將開始啟用 LDAP 驗證。
          這個工具將會把指令 pam_password 的值設(shè)置為 md5。為了讓用戶可以成功地修改密碼,您需要手工將這個指令值設(shè)置為“clear”。

          現(xiàn)在我們可以作為信息存儲在 Directory Server 服務(wù)器上的用戶來登錄了。例如,以 user1 的身份登錄:




          Click here to open new window

          因為沒有 user1 的主目錄,所以登錄 shell 自動將目錄切換到“/”。為方便起見我們可以手工添加用戶主目錄:
          #mkdir /home/user1
          #cp /etc/skel/.* /home/user1
          #chown -R user1:user1 /home/user1





          現(xiàn)在再次以 user1 身份登錄,不再出現(xiàn)警告:




          Click here to open new window

          OK,好極了! 我們已經(jīng)實現(xiàn)了一個基本的配置,可以利用 Directory Server 來對 Linux 系統(tǒng)用戶進行驗證。因為 Linux 和 Directory Server 都支持 Secure Sockets Layer (SSL),所以我們可以做更深入的配置以提高系統(tǒng)的安全性。

          posted @ 2013-10-31 09:45 Eric_jiang 閱讀(298) | 評論 (0)編輯 收藏

          僅列出標(biāo)題
          共57頁: First 上一頁 14 15 16 17 18 19 20 21 22 下一頁 Last 
          主站蜘蛛池模板: 泰顺县| 呈贡县| 广东省| 新平| 秦皇岛市| 勐海县| 辉南县| 郓城县| 谢通门县| 竹北市| 佛教| 新巴尔虎右旗| 辽阳市| 郓城县| 桓台县| 南川市| 象州县| 六盘水市| 南岸区| 郧西县| 婺源县| 辽源市| 察哈| 松江区| 白朗县| 韶山市| 晋中市| 巴青县| 贵州省| 石城县| 锦屏县| 惠安县| 凯里市| 宣武区| 靖边县| 合作市| 达拉特旗| 沙雅县| 大厂| 桃园市| 崇文区|