2008年12月7日 星期日

ifup,ifdown

用以單獨啟動或停止指定單一網卡
ifup eth0 啟動 eth0 介面之網卡
ifdown eth1 停用 eth1 介面之網卡 

Hyperic Server and Agent Command

vap16(10.10.2.244) 內的hyperic ,要以hyperic帳號登再執行
Server:/home/hyperic/server-3.2.0/bin/hq-server.sh start|stop
Agent:/home/hyperic/agent-3.2.0/hq-agent.sh start | stop | ping | setup

VMware Command

vmrun list 列出目前主機上正開啟的 Guest OS有那幾個
如 /vmdata/vap16/vap16.vmx
vmrun start|stop|reset|suspend  [PARAMENTERS]
此指令可以Command 的方式 啟動|停止|重開機|暫停 Guest OS
後面代入以 vmrun list 得到的資訊
如 vmrun start /vmdata/vap16/vap16.vmx 啟動vap16 Guest OS


2008年10月14日 星期二

rm -f `find /usr/data/  -size 0k` 當file Size 為0的
rm -f `find /usr/data/ -atime +30` 當file 最後被讀取的時間 超過30天
-atime  最後被讀取的時間
-ctime  最後被修改的時間

2008年10月12日 星期日

adduser

名稱:adduser 
使用權限:系統管理員  
使用方式:adduser [-c comment] [-d home_dir] 
[-e expire_date] [-f inactive_time] 
[-g initial_group] [-G group[,...]] 
[-m [-k skeleton_dir] | -M] [-p passwd] 
[-s shell] [-u uid [ -o]] [-n] [-r] loginid 
或 adduser -D [-g default_group] [-b default_home] 
[-f default_inactive]  
[-e default_expire_date] 
[-s default_shell] 
附注:adduser 與 useradd 指令為同一指令(經由符號連結 symbolic link) 
說明:新增使用者帳號或更新預設的使用者資料 
參數: 
-c comment 新使用者位密碼檔(通常是 /etc/passwd)的注解資料 
-d home_dir 設定使用者的家目錄為 home_dir ,預設值為預設的 home 面加上使用者帳號 loginid 
-e expire_date 設定此帳號的使用期限(格式為 YYYY-MM-DD),預設值為永久有效 
-f inactive_time 范例: 


 adduser是增加使用者. 
相對的,也有刪除使用者的指令,userdel. 
語法:userdel [login ID] 
 
以上資料截至
http://fanqiang.chinaunix.net/a1/b1/20010430/144909_b.html

2008年9月18日 星期四

vmstat


kthr      memory            page            disk          faults      cpu

r b w   swap  free  re  mf pi po fr de sr f0 m2 m2 m2   in   sy   cs us sy id

0 0 0 156352 168880 29  94 147 0  0  0 67  0  0  0  0  441  481   76  6  4 89在命令行收集虛擬記憶體性能的資料

procs:

r-->在運行佇列中等待的進程數

b-->在等待io的進程數

w-->可以進入運行佇列但被替換的進程

memoy

swap-->現時可用的交換記憶體(k表示)

free-->空閒的記憶體(k表示)

pages

re--》回收的頁面

mf--》非嚴重錯誤的頁面

pi--》進入頁面數(k表示)

po--》出頁面數(k表示)

fr--》空餘的頁面數(k表示)

de--》提前讀入的頁面中的未命中數

sr--》通過時鐘演算法掃描的頁面

disk 顯示每秒的磁片操作。 s表示scsi盤,0表示盤號

fault 顯示每秒的中斷數

in--》設備中斷

sy--》系統中斷

cy--》cpu交換

cpu 表示cpu的使用狀態

cs--》用戶進程使用的時間

sy--》系統進程使用的時間

id--》cpu空閒的時間

如果 r經常大於 4 ,且id經常少於40,表示cpu的負荷很重。

如果pipo 長期不等於0,表示記憶體不足。

如果disk 經常不等於0 且在 b中的佇列 大於3 表示 io性能不好。

2008年9月16日 星期二

找檔案的大小

檔案大小:
使用 find 程式時,透過 -size 參數的使用,可以精準的搜尋出
特定檔案長度的檔案。-size 參數的使用,支援的單位有:

b:block (1 block = 512 byte)
c:byte
k : kbyte
w : word byte

實際在使用時,可以搭配 + 與 – 表示大於或者是小於指定的大小。

使用範例 1:
搜尋 /bin 目錄內,檔案長度為大約為 10K 的一般檔案
find /bin -type f -size 10k

使用範例 2:
搜尋 /bin 目錄內,以 a ~ m 開頭,檔案長度大於 10K 的一般檔案
find /bin -type f -name “[a-m]*” -size +10k

使用範例 3:
搜尋 /usr/bin 目錄內,檔案長度在 50k ~ 100k 範圍內的檔案
find /usr/bin -type f -size +50k –size -100k

2008年8月23日 星期六

GT4 免費改裝

1.到設定把自動存檔關掉(※一定要關掉)

2.從車庫裡選一台自己想改裝的車或是買一台想改裝的車然後換乘此輛車

3.隨便再換乘另一台車然後手動存檔

4.在換乘剛才想改裝的車然後去改裝

5.改裝完後再隨便買一台新車然後換乘該輛新車(※不要存檔)

6.PS2主機重新啟動然後在車庫選擇剛才改的車換乘後就會發現已經改裝了

*第5點,不必買新車,隨便換臺別的就好.

*還有是重新進入後,在列表上看到的是原來的馬力,再換成它就變成改裝後的馬力

2008年8月20日 星期三

OpenWebMail

1、安装openwebmail 2.51软件:
安裝環境:RH4 + Sendmail + Apach + Openwebmail
# service httpd restart (启动httpd服务)
停止 httpd: [ 确定 ]
启动 httpd: [ 确定 ]

# rpm -ivh perl-5.8.5-12.1.i386.rpm
# rpm -ivh perl-CGI-SpeedyCGI-2.22-1.2.el4.rf.i386.rpm
# rpm -ivh perl-Compress-Zlib-1.34-1.2.el4.rf.i386.rpm
# rpm -ivh perl-suidperl-5.8.5-12.1.1.i386.rpm
# rpm -ivh perl-Text-Iconv-1.4-1.2.el4.rf.i386.rpm

# rpm -ivh openwebmail-2.51-1.i386.rpm

warning: openwebmail-2.51-1.i386.rpm: V3 DSA signature: NOKEY, key ID cfb164d8
Preparing... ######################################### [100%]
1penwebmail ###################################### [100%]

You may login with non-root account from
http://mail.easy.com/cgi-bin/openwebmail/openwebmail.pl

# cd /var/www/cgi-bin/openwebmail/

# ./openwebmail-tool.pl --init

Please change './etc/dbm.conf' from

dbm_ext .db
dbmopen_ext none
dbmopen_haslock no

to

dbm_ext .db
dbmopen_ext .db
dbmopen_haslock no


And execute './openwebmail-tool.pl --init' again!

ps: If you are running openwebmail in persistent mode,
don't forget to 'touch openwebmail*.pl', so speedycgi
will reload all scripts, modules and conf files in --init.
2、修改 /var/www/cgi-bin/openwebmail/etc/openwebmail.conf 文件:

domainnames auto
更改为:
domainnames zoomsky.com (更改为自己定义的域名)

default_language en
更改为:
default_language zh_CN.GB2312 (更改为简体中文版介面)

default_iconset Cool3D.Englist
更改为:
default_iconset Cool3D.Chinese.Simplified (更改为中文3D按键)

3、修改/var/www/cgi-bin/openwebmail/etc/defaults/openwebmail.conf文件:

smtpserver 127.0.0.1
更改为:
smtpserver 192.168.0.77 (更改smtp服务器的地址)

authpop3_server localhost
更改为:
authpop3_server 192.168.0.77 (更改pop3服务器的地址)

4、修改/var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf文件:

dbmopen_ext none
更改为:
dbmopen_ext .db

dbmopen_haslock no
更改为:
dbmopen_haslock yes

smtpserver 192.168.1.253 (添加smtp服务器的地址)
5、继续运行openwebmail-tool.pl文件:

# ./openwebmail-tool.pl --init

creating db /var/www/cgi-bin/openwebmail/etc/maps/b2g ...done.
creating db /var/www/cgi-bin/openwebmail/etc/maps/g2b ...done.
creating db /var/www/cgi-bin/openwebmail/etc/maps/lunar ...done.
Welcome to the Open WebMail!

This program is going to send a short message back to the developer,
so we could have the idea that who is installing and how many sites are
using this software, the content to be sent is:

OS: Linux 2.6.9-11.EL i686
Perl: 5.008005
WebMail: Open WebMail 2.51 20050228

Send the site report?(Y/n) y (输入y,然后按回车键)
sending report...

Thank you.


6、测试webmail方式收发电子邮件:

在ie中输入以下地址:

http://127.0.0.1/cgi-bin/openwebmail/openwebmail.pl


以上資料截自 http://www.ixpub.net/redirect.php?fid=223&tid=672660&goto=nextnewset

2008年8月7日 星期四

啟動 Oracle DB / 停用 Oracle DB

起動 db
su - oracle
lsnrctl start
sqlplus /nolog
conn / as sysdba; 本機的DB
startup
exit

停止 db
su - oracle
sqlplus /nolog
conn / as sysdba; 本機的DB
shutdown

若停不下來,則再執行以下指令
shutdown abort
startup
shutdown immediate

2008年7月22日 星期二

set IP object

NetScreen-25
以Telnet 方式加 IP object
set address "區域" "Name" IP Mask "Comment"
Ex.
set address "Untrust" "A0006-05" 111.222.1.2 255.255.255.255 "xxx Source IP"

2008年7月16日 星期三

MySQL reset root password

service mysqld stop
mysqld_safe --skip-grant-tables &
mysql -u root mysql

UPDATE user SET password=PASSWORD("abcd") WHERE user="root";
FLUSH PRIVILEGES;
exit
service mysqld restart

2008年7月13日 星期日

SSH 免密碼的做法

假設前提:
Server 部分為 linux.dmtsai.tw 這部 192.168.0.2 的主機,欲使用的 User 為 user1 這個帳號;
Client 部分為 test2.dmtsai.tw 這部 192.168.0.100 PC 的 user2 這個帳號, 他要用來登入 192.168.0.2 這部主機的 user1 這個帳號。

$user2@test2 ~]$ ssh-keygen -t rsa <==這個步驟在產生 Keys

Generating public/private rsa key pair. Enter file in which to save the key (/home/user2/.ssh/id_rsa): <==這裡按下Enter

Enter passphrase (empty for no passphrase): <==這裡按 Enter

Enter same passphrase again: <==再按一次 Enter

Your identification has been saved in /home/user2/.ssh/id_rsa. <==這是私鑰

Your public key has been saved in /home/user2/.ssh/id_rsa.pub. <==這是公鑰

# 注意: -t 指的是『使用何種密碼演算方式?』由於我們使用 RSA ,
# 所以直接輸入 -t rsa 即可建立兩支 Keys !
# 此外,建立的兩把 Keys 都放置在家目錄下的 .ssh 這個目錄中!
ls -al ~/.ssh
total 12
-rw------- 1 user2 user2 887 Nov 12 22:36 id_rsa
-rw-r--r-- 1 user2 user2 233 Nov 12 22:36 id_rsa.pub
-rw-r--r-- 1 user2 user2 222 Oct 31 11:20 known_hosts
PS. 家目錄的權限必需為755

請注意, 私鑰必需要放置在家目錄底下的 .ssh 裡面,~/.ssh/id_rsa
~/.ssh 目錄權限為700,私鑰的檔案權限為600

在 Server 端放置可以登入的公鑰:
既然我們要讓 test2 主機可以用 user2 這個帳號登入 linux.dmtsai.tw 這部主機的user1,那麼這部主機自然需要保有 user2 的 public key 囉!所以我們必需要將 Client 端建立的 id_rsa.pub 檔案給他拷貝到 linux.dmtsai.tw 裡頭的 user1 這個使用者的家目錄之下

較早期的作法
被登入的主機的某個帳號,他的公鑰放置的檔案名稱預設就是 authorized_keys
$user2@test2 ~]$ scp ~/.ssh/id_rsa.pub linux.dmtsai.tw:/home/user1/.

改登入linux.dmtsai.tw的user1 帳號
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys

新的做法
直接在Client 主機中執行以下指令
ssh USERNAME@HOSTNAME 'mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys'  < ~/.ssh/id_rsa.pub


ssh-copy-id USERNAME@HOSTNAME
直接將Client 主機的Root 的金鑰送到指定的主機

若要指定使用的金耀
ssh-copy-id -i ~/.ssh/id_rsa.pub USERNAME@HOSTNAME
(參考文章 https://blog.gtwang.org/linux/linux-ssh-public-key-authentication/)

較早期的作法
authorized_keys 權限為600
請注意上面的機器!由於 authorized_keys 可以保存相當多的公鑰內容,因此, 可以使用>> 的方式來將 Client 端的公鑰新增到該檔案內

登入測試
user2@test2 ~]$ ssh user1@linux.dmtsai.tw
基本上應該是不會問你密碼了,如果還是會問,再檢查一下檔案的權限跟與路徑是否正確

請注意, user1 不能以 user2 登入 test2.linux.org

Install sshd for cygwin

  • For Windows XP , open a cygwin window by double clicking the icon; a black screen pops open,
  • For Windows Vista , right click the icon and choose "run as administrator"; a black screen pops open, type

  • ssh-host-config -y (on slower computers, it may take several minutes to generate the dsa security keys)
    If the script asks you about "privilege separation", answer yes
    If the script asks about "create a local user sshd on this machine", answer yes
    If the script asks you about "install sshd as a service", answer yes

  • Windows Vista
    If Vista asks "create a new local account ssh_server which has the required privileges" answer yes

  • When the script stops and asks you for "environment variable CYGWIN=" your answer is ntsec or tty
    (click here for an explanation of ntsec)

  • Start sshd
    net start sshd
    or
    cygrunsrv --start sshd

  • Stop sshd
    net stop ssh
    or
    cygrunsrv --stop sshd

  • If the service fails to start, try
    chown system /etc/ssh*
    chown system /var/empty
    net start sshd

  • Important Pop a cygwin window, harmonize Windows user information with cygwin, otherwise they cannot login
    After you created (or removed) Windows users
    mkpasswd -cl > /etc/passwd
    mkgroup --local > /etc/group

    mkpasswd creates a password file from Windows' user list
    mkgroup creates a group file from Windows' user list

  • Test to see if sshd is working, pop a cygwin window (note: the command below is case sensitive)
    whoami
    ssh localhost

    or
    ssh -vvv localhost
    or
    ssh $USERNAME@127.0.0.1

  • if ssh complains "The authenticity of host xx.xx.xx.xx can't be established .... Are you sure you want to continue connecting (yes/no)?" Answer yes (Thanks to Daniel Griscom of Suitable Systems)
  • If you get an error message like "ssh-exchange-identification: Connection closed by remote host", it is probably caused by McAfee 8.0i, see this page about the fix. (Thanks to Ron Dozier of University of Delaware, USA)
  • If you get an error message like "entry point _getreent", or "QuerryService Status: Win32 error 1062", it is probably caused by the existance of an older version of "cygwin1.dll" located in the search path. Do a full serarch of "cygwin1.dll" and remove the old version, except the current version at c:\cygwin\bin (Thanks to Joe britton)

  • If you get a prompt without error messages, type
    cd /cygdrive/c
    if you see a directory listing, success!

    If you have troubles ssh into the server, try run ssh-user-config

以上資料轉載自 http://pigtail.net/LRP/printsrv/cygwin-sshd.html

2008年7月11日 星期五

standard input output

Redirector and Pipes and Stream
(1) Stream:
stdin ( standard input ),代表數字0。
stdout ( standard output ),代表數字 1。
stderr ( standard error ),代表數字 2。
stdin 預設為從 keyboard 輸入。stdout、stderr 此兩種輸出類型則預設輸出至 screen。

2008年7月10日 星期四

WebLogic MEM_ARGS 參數設定

WebLogic用了一段時間之後,偶爾總是會出現OutOfMemory,這對測試環境來說,還只要Restart Server 就可以解決,但是在正式環境上出現可就麻煩大了,因為一Restart Server 所有User就都無法使用系統,所以MEM_ARGS這個參數的設定就很重要。
這是我SIT目前的設定,依不同的系統做不同的設定
MEM_ARGS="-Xms768m -Xmx768m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:MaxPermSize=384m -XX:PermSize=384m -XX:SurvivorRatio=6 -XX:+DisableExplicitGC"
提示:以上記得要寫成一行。

Heap Size設定
-Xms 設定一開始的Heap Size。
-Xmx 設定Heap Size的最大值 (最好是不是超過實體記憶體的80%)。
-XX:NewSize 調整JVM的Young Generation的size大小。
-XX:MaxNewSize 調整JVM的Young Generation的size的最大值。
-Xmn Young Generation的size,NewSize 和 MaxNewSize設定為一樣。
-XX:NewRatio 控制Young generation的比例,如-XX:NewRatio=3表示Young generation與Old generation的比例為1:3,即Young generation佔1/4,Old generation佔3/4。
Young generation又被分成三部分,第一部分Eden,用於生成新的Object。另外兩個部分為Survivor空間,當Eden用完後,會將Objects複製到"SS1",當SS1空間滿了的時候,再被複製到"SS2",Objects會在Survivor空間不斷的被複製,直到他滿足條件進入Old generation止。
提示:如果將Heap Size設的越大,GC的週期就會拉長,而且每次GC的時間也會越長。

PermGen space
-XX:PermSize 這一部分是用於存放Class和Meta的訊息,Class在被 Load的時候被放入PermGen space區域,它和和存放Instance的Heap區域不同,GC(Garbage Collection)不會在主程式運行期間對PermGen space進行清理,所以如果你的APP會LOAD很多CLASS的話,就很可能出現PermGen space錯誤。這種錯誤常見在web伺服器對JSP進行pre compile的時候。

整個記憶體配置會像這樣


-XX:+DisableExplicitGC 加了這個參數會停止掉WLS或是程式內直接呼叫GC,減少不必要的GC,將GC交由JVM去執行。

Garbage Collection描述:
Garbage Collection分多種等級,0級就是全部的垃圾回收(Full GC),會回收Old generation中的垃圾;1級或以上為部分垃圾回收,只會回收Young中的垃圾,會發生OutOfMemory通常是產生於Old generation或Perm段垃圾回收后,仍然沒有記憶體空間來存放新的Java 物件的情況。

當一個URL被訪問時,記憶體的配置過程如下:
A. JVM會試圖為Java的相關對象在Eden中初始化一塊記憶體空間
B. 當Eden空間足夠時,記憶體配置結束。否則到下一步
C. JVM會試圖釋放在Eden中所有不活躍的對象(這是屬於1或更高級的垃圾回收);釋放後若Eden空間仍然不足以放入新對象,則會試圖將部分Eden中活躍的對象放入Survivor區/OLD區
D. Survivor區被用來作為Eden及OLD的中間交換區域,當OLD區空間足夠,Survivor區的對象會被移到Old區,否則被保留在Survivor區
E. 當OLD區空間不足時,JVM會在OLD區進行完全的垃圾收集(0級)
F. 完全垃圾收集后,若Survivor及OLD區仍然無法存放從Eden複製過來的部分對象,就會導致JVM無法在Eden區為新的對象配置出記憶體區塊,產生"out of memory的錯誤"

以我的設定為例:
MEM_ARGS="-Xms768m -Xmx768m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:MaxPermSize=384m -XX:PermSize=384m -XX:SurvivorRatio=6 -XX:+DisableExplicitGC"

在上面的例子中:
YOUNG+OLD: 768M
YOUNG: 256M
Perm: 384M
Eden: YOUNG*6/(6+1+1)=192M
Survivor: YOUNG*1/(6+1+1)=32M

Heap Size: YOUNG+OLD+Perm=1024M




  以上是WebLogic記憶體參數的一些基本的設定,太難的我也不會,只是整理一些心得而己,提供做一下參考。
以上資料轉載自 http://prince1005.spaces.live.com/blog/cns!45B42DFAD425C0D4!762.entry

2008年7月4日 星期五

Howto Remote Root Access to MySql

現在新版的,有一點點不一樣

先從本機登入資料庫
mysql -u root -p
use mysql;

#root
GRANT * ON *.* TO root@'%' identified by '123';
說明如下
GRANT *,這裡的*指的是權限 ,例如 SELECT,INSERT,UPDATE,DELETE 。你也可以只單單賦予 SELECT 權限,例如 GRANT SELECT
ON *.*,這裡的第一個*,是Schema,第二個*是TABLE,例如一個Schema叫project,裏頭有個TABLE叫 USER,所以這裡就可以寫成 ON project.user
root@'%',root就是你要給予的帳號,%是指定的IP區段,例如192.168.0.1,192.168.0.%, 192.168.%.%, 192.%,%,%, 127.0.0.1, localhostu 依此類推
'123',則是密碼

更新權限表,這個指令沒有執行,前面就白做了。
FLUSH PRIVILEGES;


-------------------- 我是分隔線 ----------------------------
舊的版本方式

1.set root password.

mysql -u root

設定 root
mysql> SET PASSWORD FOR 'root'@'LOCALHOST' = PASSWORD('123');
mysql> SET PASSWORD FOR 'root'@'192.168.0.1' = PASSWORD('234');
mysql> SET PASSWORD FOR 'root'@'192.1680.100' = PASSWORD('345');

以上,從不同地方的IP登入,密碼就會是不同,請注意!!


設定 root 可以從任何地方來登入

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123123' WITH GRANT OPTION;

*.* 表示 schema.object 如 company.webuser

'%' 表示任何地方



mysql> exit

We’re almost done now. We just have to tell Mysql to allow remote logins.

vi /etc/my.cnf

DB 資料存放處所
datadir=/var/lib/mysql

2008年6月30日 星期一

在RHEL5架設DNS Server

RHEL5跟以往RHEL4與RHEL3在架設DNS Server時,有些不一樣,
不一樣的地方在於,ㄟ~~configure file怎麼都沒看到哩,
還有預設的zone files哩,怎麼都沒有呀?!要我自己產生嗎?
OH MY GOD! 那有可能呀!所幸今天在高人的指點下,
找到了這些檔案身在何處呀!果然是高手高手高高手呀!

01- 安裝system-config-bind這隻套件
02- 到/usr/share/system-config-bind/profiles/下就可以找到named.conf與zone files.
03- 接下來把named.conf copy到 /var/named/chroot/etc/
04- 再把zone files copy到 /var/named/chroot/var/named/
05- 最後把將 /usr/share/doc/bind-*/sample/var/named/named.root copy到/var/named/chroot/var/named/

這樣就大功告成啦!剩下的就是自己改named.conf與新增網域正反解的zone files囉!
文張轉載自 http://go-linux.blogspot.com/2007/06/rhel5dns-server.html

2008年6月25日 星期三

How to set size limits for messages in Exchange Server

This article was previously published under Q322679

On This Page
SUMMARY
MORE INFORMATION
Global setting
Connector setting
SMTP virtual server setting
User mailbox setting
Examples of effective size limits
Example 1
Example 2

SUMMARY
This article describes the different kinds of limits that you can set on message size in Microsoft Exchange 2000 Server and in Microsoft Exchange Server 2003. It also explains how you can set these limits.

Note If you have configured a size limit on either the Send or Receive sizes in global settings, the More Restrictive limit applies to both incoming and outgoing e-mail messages.

MORE INFORMATION
Size limits for messages depend on various settings. Settings can vary across users. You can customize the settings for the Exchange 2000 or Exchange 2003 organization, a specific connector, a specific virtual server, and an individual user.

Senders may receive a non-delivery report (NDR) that is similar to the following example if their messages are larger than their size limits:

Your message did not reach some or all of the intended recipients.
Subject: Test
Sent: 7/18/2002 2:40 PM
The following recipient(s) could not be reached:
Test Recipient on 7/18/2002 2:41 PM
This message is larger than the current system limit or the recipient's mailbox is full. Create a shorter message body or remove attachments and try sending it again.

Global setting
This setting determines the maximum size of the messages in the Exchange 2000 organization; the messages can be incoming, outgoing, or internal.

To configure the global setting, follow these steps:
1.Start Exchange System Manager. To do this, click Start, point to Programs, point to Microsoft Exchange, and then click System Manager.
2.Expand Global Settings.
3.Right-click Message Delivery, and then click Properties.
4.Click the Default tab to configure the global settings.

Connector setting

The settings for each connector control the maximum size of outgoing messages that users can send through the connector.

To configure the connector settings, follow these steps:

1.Click Start, point to Programs, point to Microsoft Exchange, and then click System Manager.
2.Expand Administrative Groups, and then expand Administrative Group Name, where Administrative Group Name is the name of your administrative group.
3.Expand Routing Groups, and then expand Routing Group Name, where Routing Group Name is the name of your routing group.
4.Expand Connectors, right-click the connector that you want to configure, and then click Properties.
5.On the Content Restrictions tab, under Allowed sizes, click to select the Only messages less than (KB) check box, and then type the size (in KB) that you want to permit.

SMTP virtual server setting
This setting determines the maximum size of a message that is permitted to pass through a virtual server. The virtual server advertises the limit by means of the Extended Simple Mail Transfer Protocol (ESMTP) SIZE command verb (RFC 1870).

Note The protocol size restriction is meant to reject messages on boundaries with other e-mail systems. These restrictions are effective for individual servers and should not be used as methods to limit the message size in an Exchange enterprise server group. Administrators can set the message delivery option in the global settings to limit and to control the message size restriction across an organization that uses Exchange 2000 or Exchange 2003. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

326154 The OAB does not replicate if you set a message size restriction at the transport level

To configure the Simple Mail Transfer Protocol (SMTP) virtual server setting, follow these steps:
1.Click Start, point to Programs, point to Microsoft Exchange, and then click System Manager.
2.Expand Administrative Groups, and then expand Your Administrative Group Name, where Your Administrative Group Name is the name of your administrative group.
3.Expand Servers, and then expand Your Server Name, where Your Server Name is the name of your server.
4.Expand Protocols, and then expand the SMTP node.
5.Right-click SMTP Virtual Server Name, where SMTP Virtual Server Name is the name of your SMTP virtual server, and then click Properties.
6.Click the Messages tab to set the maximum size that you want to permit.

User mailbox setting
This setting determines the maximum size of a message that users can send or receive through their mailboxes. User mailbox settings are enforced by the information store instead of by the message categorizer. The information store prevents an oversized message from being sent to Transport if the message size exceeds the user mailbox maximum message size setting.

To configure an individual user's mailbox settings, follow these steps:
1.
Start the Active Directory Users and Computers snap-in, and then locate the user account that you want to configure.
2.
Right-click the user's account, and then click Properties.
3.
Click the Exchange General tab, and then click Delivery Restrictions to set the maximum size that you want to permit.

Note The size of SMTP messages that are sent between routing groups and to the Internet increase by about 30 percent if they contain binary attachments or other 8-bit data.

Examples of effective size limits
Example 1
In this example, the following size limits have been configured:
•The global setting is set to 5 MB.
•The Exchange SMTP connector is set to 3 MB.
•The SMTP virtual server is set to 4 MB.
•The user mailbox setting is set to 2 MB.

Because of these settings, users in the Exchange 2000 or Exchange 2003 organization can send and receive messages that are a maximum of 5 MB. Users can send messages through the connector that are a maximum of 3 MB. All mail that passes through the SMTP Virtual Server (sending or receiving) is limited to 4MB. The individual user, whose mailbox setting is 2 MB, is also limited to sending and receiving messages that are a maximum of 2 MB.

Example 2

In this example, the following size limits have been configured:
•The global setting is set to 2 MB.
•The Exchange 2000 SMTP connector is set to 5 MB.
•The SMTP virtual server is set to 2 MB.
•The user mailbox setting is set to 3 MB.

The global setting is 2 MB. Therefore, all the users who are using the default global setting in the Exchange 2000 Server organization or in the Exchange Server 2003 organization are limited to sending and receiving messages that are a maximum of 2 MB. If an individual user has a mailbox setting of 3 MB, that user overrides the global setting.

Note All Internet e-mail messages use the global setting for limits on sending and on receiving. The message categorizer evaluates the sender's sending limit and the recipient's receiving limit. In example 2 earlier, a user with a user mailbox limit of 3 MB could receive messages from another user with a 3-MB sending limit. Because Internet users use the global setting, they can send only a 2-MB message.

APPLIES TO
•Microsoft Exchange Server 2003 Enterprise Edition
•Microsoft Exchange Server 2003 Standard Edition
•Microsoft Exchange 2000 Server Standard Edition


Keywords: kbinfo KB322679

2008年6月20日 星期五

JBoss 程式 ReLoad

JBoss 在布署程式完成啟動後
若布署的程式變動,只需要Touch /opt/app/GLORY.war/WEB-INF/web.xml 這個檔案,JBoss 就會ReLoad 這一個程式

2008年6月16日 星期一

JDK安裝

1.OS:Linux (RH4 or Fedora皆可)
2.下載 j2sdk-1_4_2_13-linux-i586-rpm.bin
3.安裝chmod 755 j2sdk-1_4_2_13-linux-i586-rpm.bin
4.執行./j2sdk-1_4_2_13-linux-i586-rpm.bin
5.版權說明,最後要輸入yes
6.rpm -Uvh j2sdk-1_4_2_13-linux-i586.rpm
7.cd /usr/java/j2sdk1.4.2_13/bin
8../java -version 可以看安裝的版本為何
java version "1.4.2_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_13-b06)
Java HotSpot(TM) Client VM (build 1.4.2_13-b06, mixed mode)

/etc/hosts.deny 用法

/etc/hosts.deny
vsftpd:192.168.1.0/255.255.255.0
sshd:192.168.1.0/255.255.255.0

IPTABLES

Chkconfig iptables on
Service iptables restart
Iptables –L 列出設定
Iptables –F 清除設定
Service iptables save 存檔

AutoMount 用法

Chkconfig autofs on
Vi /etc/auto.master
/data /etc/auto.misc –timeout=60
vi /etc/auto.misc
* -ro,soft,intr 192.168.0.250:/home/rhome/&
mkdir /home/rhome
chmod 777 /home/rhome
service autofs restart

拯救 LVM File System 方式

週六, 二月 18, 2006, 11:58 AM - 技術小技巧, Linux
因為誤砍 /etc 導致無法正常登入與開關機.. 拯救過程如下:
1. 使用 原本安裝光碟開機.. [F5] 知道使用 linux rescue 方式啟動
2. 因為使用 LVM 所以會發現找不到開機區, 所以進入 # 模式
3. 透過 Google 老師指點找到 http://wiki.linuxquestions.org/wiki/LVM 文章
4. 依樣在 # 模式下輸入:
a. lvm vgsvcan
b. lvm vgchange -a y <-- 這樣就可以看到 /dev/VdGroup* 的設備
c. cd /mnt
d. mkdir root
f. mount /dev/VolGroup00/LogVol00 /mnt/root <-- 這樣就可以將原本的 / 對應到 /mnt/root 內
5. cd /mnt/root 之後就可以開始修改 /etc 拯救了..
6.fsck /dev/VolGroup00/LogVol00 做磁碟修復檢查
以上內容來自 <http://web.ichiayi.com/blog/index.php?m=02&y=06&entry=entry060218-115828>

LVM 建立與使用

Fdisk /dev/hda
N +200M
T (dev/hdaxx) code=8e
P w
Partprobe
Pvcreate /dev/hdaxx /dev/hdaxx
Pvdisplay
Vgcreate vg00 /dev/hdaxx /dev/hdaxx
Vgdisplay
Lvcreate –l +100M -n lv00 vg00
Mke2fs –j /dev/vg00/lv00
Mount –t ext3 /dev/vg00/lv00 /media/lvm
Df –h

加大VG
vgextend vg00 /dev/hdaxx /dev/hdaxx

加大LV
lvextend -L +100M /dev/vg00/lv00

線上動態變更磁碟大小
ext2online /dev/vg00/lv00 該磁碟必須為已掛載狀態才能更新

REDHAT 5 後改用此指令
resize2fs  /dev/vg00/lv00   

因為resize2fs 只有 ext2, ext3, ext4,  如果是XFS 格式則改用

xfs_growfs /dev/vg00/lv00
若沒有安裝可以用以下指令
yum install xfsprogs.x86_64 –assumeyes

Crontab

Croutab –u username –e
分 時 日 月 星期 指令
1 15 * * * echo “hole!!” 每天的下午3:01分秀出 helo!!

Dovecot 建立

Chkconfig dovecot on
Vi /etc/dovecot.conf
找到#protocols = imap imaps
並改成protocols = pop3
service dovecot restart
netstat –ntlup grep 110

imaps
vi /etc/dovecot
找到pop3將”#”去除並加入iamps
找到iamps_listen 加上192.168.1.196
找到 ssl_cert_file= 並將兩行值皆改為
/usr/share/ssl/certs/dovecot.pem
cd /usr/share/ssl/certs/ 將原有dovecot.pem 刪除
make dovecot.pem
service dovecot restart
netstat –ntlup grep dovecot

不允許192.168.0.0/24網段進行存取
iptable –A INPUT –p tcp –dport 110 –s 192.168.0.0/255.255.255.0 –j REJECT
iptable –A INPUT –p tcp –dport 993 –s 192.168.0.0/255.255.255.0 –j REJECT
service iptables save

Quota 建立

Vi /etc/fstab
LABEL=/home1 /home ext3 defaults,usrquota,grpquo 0 0
Reboot
Quotacheck –auvg
Quotaon –auvg
Ls /home 是否有 aquota.user 及 aquota.group
Edquota g1 <<單為為KB block*soft >>
Filesystem blocks soft hard inodes soft hard
/dev/hda5 5000 3000 5000 8 0 0
設定完成,進行測試
dd if=/dev/zero of=test.txt bs=1024000 count=3 ->應該要出現警告
dd if=/dev/zero of=test.txt bs=1024000 count=5 ->應該要出現警告

Sendmail Server 建立

Chkconfig sendmail on
Vi /etc/mail/sendmail.mc
找到127.0.0.1複製並修改為192.168.1.196
m4 sendmail.mc > sendmail.cf
vi /etc/hosts
192.168.1.196 station00.example.com www00.exapmle.com
vi /etc/mail/access
192.168.1.196 RELAY
vi /etc/mail/local-host-names
station00.example.com
vi /etc/mail/virtusertabl
sysadmin@station00.example.com g2
service sendmail restart
netstat –ntlupgrep sendmail
cd /var/spool/mail
rm –rf *
echo “12345”mail g1@station00.example.com –s test1
ls 應該要有g1的檔案,可用cat看檔暗內容
echo “12345”mail sysadmin@station00.example.com –s test2
ls 應該要有g2的檔案,可用cat看檔暗內容

要求 SMTP 使用身份認証
vi /etc/mail/sendmail.mc
找到CRAM-MD5並將以下兩行的dnl去除
m4 sendmail.mc > sendmail.cf
chkconfig saslauthd on
service saslauthd restart
service sendmail restart
telnet 127.0.0.1 25
ehlo station00.example.com
應該要能看到250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN

smtp over ssl
vi /etc/mail/sendmail.mc
找到CACERT 並將以下四行dnl去除
m4 sendmail.mc > sendmail.cf
cd /usr/share/ssl/certs
make sendmail.pem

不允許192.168.0.0/24網段進行存取
iptable –A INPUT –p tcp –dport 25 –s 192.168.0.0/255.255.255.0 –j REJECT
service iptables save

NFS 建立

Chkconfig nfs on
Vi /etc/exprots
/data 192.168.1.0/255.255.255.0(rw)
service nfs restart
rpcinfo –p 127.0.0.1
showmount –e 192.168.1.196
mount –t nfs 192.168.1.196:/data /media/nfs
要確定/data目錄orther要有r及x權限(2775)

Samba Server 建立

Server
Chkconfig smb on
Vi /etc/samba/smb.conf
找到workgroup = MYGROUP
加上netbios name = ststion00
找到 hosts allow 將”#”去除,並確定網段192.168.1. 是否存在
找到[myshare]將”;”去除
path=/data
write list=g1
read list =g1 g2
smbpasswd –a g1
service smb restart
netstat –ntlup grep smbd
netstat –ntlup grep nmbd

Clinent
Ssmbclient –L //192.168.1.203 看遠端電腦的資源
mount –t smbfs –o username=antonio //192.168.1.203/linux /media/smb
開機自動掛載 vi /etc/fstab//192.168.1.203/linux /media/smb defaults,username=abc,password=xxx 0 0

Cups(Print) 建立

Chkconfig cups on
Vi /etc/cups/cups.conf
移到最後一行,將Listen 127.0.0.1:631 改為0.0.0.0:631
往上找到
區域內的Allow From 127.0.0.1改為本機IP
往上找到
區域內的Allow From 127.0.0.1 改為0.0.0.0
service cups restart
netstat –ntlupgrep 631

以瀏灠器開啟http://127.0.0.1:631

Squid(Proxy) 建立

Chkconfig squid on
Vi /etc/squid/squid.conf
找到http_port 3128改為8080
找到127.0.0.1加上一行
acl worklan src 192.168.1.0/255.255.255.0
往下找到https_access deny all,移到上一行加入
http_access allow homeland
service squid restart
netstat –ntlupgrep 8080
開啟瀏灠器,加上proxy設定,port 8080,並將快取空間設為0,再啟啟http://127.0.0.1確定可否看到畫面

Apache Server 建立

必須安裝的套件 httpd-2.xxx.ent.i386.rpm
rpm –ivh httpd.xxx.rpm
chkconfig httpd on
service httpd start
相關設定 /etc/httpd/conf/httpd.conf
網頁存放處 DocumentRoot “/var/www.html”
預設瀏覽檔案DirectoryIndex index.html index.html.var
個人網頁是否開放UserDir disable,若要開放,請將此行註解掉並將 UserDir public_html註解取消
將/home/username目錄權限設為701,chmod 701 /home/antonio
個人網頁存放處 UserDir public_html
啟動時server數 StartServers 8
閒置的最少數 MinSpareServer 5
閒置的最大數MaxSpareServer 20
同時啟動最大數 ServerLimit 256
client開啟最大數(可超過ServerLimit)MaxClients 256
一個Process執行次數MaxRequestsPerChild 4000
以何身份執行User apache
以何群組執行Group apach
回應Server資訊別ServerTokens Full OS Min
是否反解用戶端名稱Hostnamelookup Off
netstat –ntlup grep 80

VirtualHost –Name Base
mkdir /var/www/vhost
mkdir /var/www/vhost/name_base
mkdir /var/www/vhost/name_base/station00
mkdir /var/www/vhost/name_base/www00
echo “This is http://www00.example.corp” > /var/www/vhost/name_base/www00/index.html
echo “This is http://statuin00.example.corp” > /var/www/vhost/name_base/station00/index.html
設定主要檔 vi /etc/httpd/conf/httpd.conf
找到NameVirtualHost 192.168.1.97:80(刪除註解並加入自己的IP)
設定兩個NameBase 的設定檔
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf.d/www00.conf
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf.d/station00.conf

vi /etc/httpd/conf.d/www00.conf

ServerAdmin root@www00.example.corp
DocumentRoot /var/www/vhost/name_base/www00
ServerName www00.example.corp


vi /etc/httpd/conf.d/station00.conf

ServerAdmin root@station00.example.corp
DocumentRoot /var/www/vhost/name_base/station00
ServerName station00.example.corp

Service httpd restart
可用tail –f /var/log/messages 來觀查啟動成功與否

VSFTP Server 建立

須要安裝的套件 vsftpd-2.0.xxx.rpm
rpm –ivh vsftpdxxx.rpm
chkconfig vsftpd on
service vsftpd start
相關設定 /etc/vsftpd/vsftpd.conf
匿名存取anonymous_enable= YES NO
匿名上傳anon_upload_enable=YES NO
改變上傳擁有者chown_uploads=YES NO
改變上傳擁有者名chown_username=nobody
預設匿名上傳檔案屬性anon_umask=077
系統帳號可否登入 local_enable=YES NO
不可登入的帳號 /etc/vsftpd.ftpusers 一行一個user name
限制local user登入ftp僅能在home directory內動
chroot_list_enable=YES NO
設定何使用者僅能在home directory內動
/etc/vsftpd/chroot_list
同一IP可建立幾個連線max_per_ip=1
伺服器最大服務數max_clients=5
匿名下載頻寬anon_max_rate=1024(Byte/Sec)
系統帳號下載頻寬local_max_rate=1024(Byte/Sec)
vsftp 服務的IP listen_address=192.168.1.254
系統帳號使用者的根目錄 local_root=/var/ftp/localuser
匿名帳號使用者的根目錄 anon_root=/var/ftp/anonuser
幾秒無動作就斷線idle_session_timeout=60 (sec)
對個別使用者進行設定 user_config_dir=/etc/vsftpd/user_config
    在/etc/vsftpd/user_config目錄中建立檔案,檔名同帳號,其內設定與前述相同。
    例如:某一個使用者(andy)的目錄要放在/var/www下
        建立 /etc/vsftpd/user_config/andy 內容為
        local_root=/var/www
    例如:某一個使用者(jack)的權限只能下載,不能上傳
        建立 /etc/vsftpd/user_config/jack 內容為
        download_enable=YES
        write_enable=NO
設定何IP可不可登入 /etc/hosts.allow and /etc/hosts.deny
vsftpd:192.168.1.97 or vsftpd:192.168.1.0/255.255.255.0

在 Linux 使用 Samba + CUPS 分享印表機

在 Linux 環境中新增印表機
允許遠端連入 CUPS Web 管理介面
使用 Samba + CUPS 分享印表機給 Windows user 使用
建置虛擬 PDF Printer 分享給 Windows user 使用
範例環境:

Fecora Core 4 (kernel: 2.6.12.4)
cups-1.1.23-15.1
ghostscript-7.07-40
samba-3.0.14a-2
system-config-printer-0.6.131.3-1
新增印表機 (需求套件: system-config-printer)

執行 printconf (文字模式) 或 printconf-gui (圖形模式) 新增印表機

連接至本機 LPT 並列埠的第一台印表機為: /dev/lp0

連接至本機 USB 介面的第一台印表機為: /dev/usb/lp0

允許遠端連入 CUPS Web 管理介面 (需求套件: cups)

設定檔: /etc/cups/cups.conf


Order Deny,Allow
Deny From All
Allow From 192.168.1.0/24



AuthType Basic
AuthClass System
Order Deny,Allow
Deny From All
Allow From 192.168.1.0/24


Browsing On
BrowseProtocols cups
BrowseOrder Deny,Allow
Deny From All
BrowseAllow From @LOCAL
Listen 0.0.0.0:631

以瀏覽器登入管理: http://your.linux.ip:631

使用 samba + cups 分享印表機給 Windows user 使用 (需求套件: samba、cups)

設定檔: /etc/samba/smb.conf

[global]
workgroup = WORKGROUP
netbios name = FC4
hosts allow = 127. 192.168.1.
printcap name = /etc/printcap
load printers = yes
printing = cups
cups options = raw
security = share

[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = yes
writable = no
printable = yes
use client driver = yes 要是沒有加上這個也會出現存取被拒

ps. 可執行 testparm 測試 smb.conf 是否設定正確; 若無法列印, 系統記錄出現 raw 錯誤訊息時, 將 /etc/cups/mime.* 關於 raw 的設定取消註解符號 ( # ) 即可.

Microsoft Windows 的操作:

新增網路印表機, 瀏覽 \\FC4 (smb.conf 設定的 netbios name) 會顯示剛剛使用 printconf 加入的印表機名稱

建置虛擬 PDF Printer 分享給 Windows user 使用 (需求套件: ghostscript、samba)

設定檔: /etc/cups/cups.conf

[PDF] (註1)
path = /tmp/pdf
browseable = yes
writeable = yes
guest ok = yes
force user = nobody

[pdfprinter] (註2)
path = /var/spool/samba
printable = yes
printing = bsd (註3)
guest ok = yes
print command = /usr/bin/printpdf %s
use client driver = yes
lpq command =
lprm command =

Shell Script: /usr/bin/printpdf (需自行建立)

#!/bin/sh

NAME=`date +%F-%H%M%S`
SRCDIR=/var/spool/samba
OUTDIR=/tmp/pdf
ps2pdf "$SRCDIR/$1" "$OUTDIR/$NAME.pdf" 2>/tmp/printpdf.error
rm -f "$SRCDIR/$1"

最後記得要 chmod a+x /usr/bin/printpdf

註1. 在 /tmp/pdf 分享列印出來的 PDF 檔
註2. 設定虛擬印表機名稱為: pdfprinter
註3. 不加這行的話就會用到 [global] 裡的 printing = cups 設定, 會出現 client-error-not-found 的錯誤

Microsoft Windows 的操作:

於 Windows 新增印表機: \\FC4\pdfprinter
使用任何支援 PostScript 的 Driver 即可.
例如: Canon → Canon PS-IPU Color Laser Copier v52.3
(名字裡有 PS 或 PostScript 的即代表支援 PostScript; 當然, Color 就是彩色的囉 :)

列印後可至 \\FC4\PDF 查看列印結果 ( .pdf 檔 )

VMWare 安裝

第一章: Linux (Host OS 設定 )
第一節:vmware的安裝
首先關閉samba這樣安裝的時候 vmware 可以自動設定 samba /etc/rc.d/initd/smb stop
1. 從 www.vmware.com 下截 xxxx.rpm (最新的版本)
2. su 變成 root
3. rpm -ivh xxxx.rpm (這會自動安裝 vmware)
4. vmware-config.pl (配置 vmware)
這裡很簡單,基本上全部按 Enter 就可以了. 但有一個要注意的就是網卡的選擇:
如果你是 eth0+ppp0 上網的,那麼這裡選 eth0 就好了
如果是 eth0+eth1 上網,這裡你就要確定你選擇了:
如果是用 eth0 上網的,那麼這裡選擇 eth1 給 vmware 用
如果是用 eth1 上網的,那麼這裡選擇 eth0 給 vmware 用
如果你只有 eth0 或者 ppp0 那麼 vmware 會自動做個 vmnet 的 NIC 出來
這裡你選擇的網卡,就是將來做ipchain時需要forward的那個interface
samba configuration 的時候可以加入username & passowrd for samba
5. 從root中退出 exit
6. 複製你的 License 到 .vmware 這個目錄下 cp license .vmware/
如果你沒有 .vmware 這個目錄.那麼 mkdir .vmware license這幾個字都是小寫 7. 在 Xwindow 下開啟一個 terminal 然後打入 vmware

以上內容來自 <http://www.study-area.net/goldencat/vmware/vmware.htm>

FTP Batch Scripts

幾乎所有 OS 都有內建文字模式的 FTP Client, 這種小巧的 FTP Client 配合批次指令, 可一次處理多個 FTP 命令, 配合系統排程亦可達成自動化傳輸功能. 操作方法如下:
《Windows》

Command:

ftp -n -s:scriptfile.scr

Script file contents:

open ftp.site.addr
user
guest (account)
guest (password)
put file1
quit

《Linux - ftp》

Script file contents:

#!/bin/sh

ftp -n ftp.site.addr << EOF
user guest guest (account password)
prompt
verbose
put file1
quit
EOF

《Linux - lftp》

Command:

lftp -f scriptfile.scr

Script file contents:

open ftp.site.addr
user guest guest (account password)
put file1
quit

Rate limit:

open /etc/lftp.conf, adding:
set net:limit-rate 10240 (bytes per second)

※man lftp for more information

VSFTPD 問題

service vsftpd status
vsftpd dead but subsys locked
service vsftpd restart
Shutting down vsftpd: [FAILED]
Starting vsftpd for vsftpd: [ OK ]

if your frame shows "vsftp dead but subsys lock".
Please follow this procedure....

i had the same problem ...i got it working in the following way

just remove the vsftpd lock from /var/lock/subsys/

then in /etc/rc.d/init.d/ directory stop the xinetd daemon.
./xinetd stop

now restart the vsftpd service

service vsftpd restart

and now start the xinetd daemon again...
./xinetd start

Hope this works

事實上若還是無法排除問題,可以前往/etc/vsftpd/vsftpd.conf查看是否文件內部有打錯
編輯?vsftpd.conf ,只留一行Listen=yes
vi??vsftpd.conf
Listen=yes

再重新啟動 vsftpd ,如果ok,則一行一行在慢慢放回去,降子就可以知道是那一個設定出了問題


netstat -na --ip

just remove the vsftpd lock from /var/lock/subsys/
then in /etc/rc.d/init.d/ directory stop the xinetd daemon.
./xinetd stop
now restart the vsftpd service
service vsftpd restart
and now start the xinetd daemon again...
./xinetd start

following commands fixed the problem
service vsftpd stop
rpm --verify vsftpd
service vsftpd start

小筆記

大量建帳號
adduser erica
adduser jessie
adduser jackson
adduser rduser
echo "123123"passwd --stdin erica
echo "123123"passwd --stdin jessie
echo "123123"passwd --stdin jackson
echo "123123"passwd --stdin rduser


建立連結
ln -s /home/f84297673 /root/bea/glink/SEJW/F0391-84297673
來源捷徑存放位置


刪除使用者,並將相關的檔案刪除
userdel -r abcuser


查尋網路流量(這需要另外安裝sysstat的套件)
sar -n DEV 1 999

分辨出哪個檔案是最大
alias kk='du -cms * sort -rn head -11'


設定Linux 時間 date -s "2007/7/16 09:41:00"
ntpdate time.stdtime.gov.tw 網路校時
clock -r 讀取BIOS時間
clock -w 將目前時間寫入BIOS
ntpdate time.stdtime.gov.tw ;clock -w

Vi /etc/crontab 讓server 自動去校時
10 5 * * * root /usr/sbin/ntpdate time.stdtime.gov.tw && /sbin/hwclock -w


VSFTP
use_localtime=YES (NO)
是否使用本地時間?vsftpd 預設使用 GMT 時間(格林威治),所以會比台灣晚 8 小時,建議設定為 YES 吧!


找出那個Process讓Device出現device is busy
範例 #umount /mnt出現
umount: /mnt: device is busy
找出兇手的方法
#fuser /mnt
/mnt: 2028c


以20070804為當前日期,取得當前日期
hwall_`date +%G%m%d`.txt 取得目前的日期 ex:hwall_20070804.txt
date1=`date --date='2 days ago' +%Y%m%d` 取得目前的日期,前兩天 ex:date1=20070802
date2=`date --date='1 days ago' +%Y%m%d` 取得目前的日期,前一天 ex:date1=20070803
date3=`date --date='1 month ago' +%Y%m%d` 取得目前的日期,前一個月
date4=`date --date='3 minute ago ' +%H%M` 取得目前的時,前3分鐘
ex:date3=20070704

也可以改用 +/- 比如date4=`date --date='3 minute ago ' +%H%M`
可以改成  date4=`date --date='-3 min' +%H%M`


查檔案內容
grep -r CSCW9645110200 * 尋找所在目錄下所有檔案,內容包含CSCW9645110200 的列出,注意!!不能設定副檔名



Linux 編譯網卡

[root@linux src]# tar -zxvf /root/e100-3.4.14.tar.gz
[root@linux src]# cd e100-3.4.14
[root@linux e100-3.4.14]# cd src 放在那邊並不重要,只要您找的到就好
[root@linux src]# make <<最主要的執行程序 [root@linux src]# cp e100.ko /lib/modules/`uname -r`/kernel/drivers/net [root@linux src]# cd /lib/modules/`uname -r` [root@linux 2.6.13-1.1532_FC4]# depmod -a Uname -r 取得目前OS的版本 >> 2.6.9-1.667smp
執行完最後一個步奏就重新開機,開機的過程就可以看到有找到新的硬體設備


Samba utf8 設定
一直聽說 Samba UTF-8 有問題.
但是因為資料實在太多. 要從 Big5 轉換到 UTF-8 看來是遙遙無期.
不過看到有人解決掉這個麻煩的事.. 趕快記錄下來 :p
以下轉載自: Samba也要utf8
smb.conf
[global]
dos charset = UTF8
unix charset = UTF8
display charset = UTF8
再來用smbmount也都ok了, 但中文就是一直會缺字, 我smbmount用的參數為iocharacter=utf8,codepage=cp950, 後來才發現原來codepage設錯了, cp950是big5的codepage number, 如果是utf8環境的話, 要用codepage=65001

Vim 編輯

:1,$s/word1/word2/gc
:1,$s/bea705/bea705_RD/gc
從第一行到最後一行尋找 word1 字串,並將該字串取代為 word2 !且在取代前顯示提示字元給使用者確認 (conform) 是否需要取代!
:1,$s/word1/word2/g
從第一行到最後一行尋找 word1 字串,並將該字串取代為 word2 !
:n1,n2s/word1/word2/g
n1 與 n2 為數字。在第 n1 與 n2 行之間尋找 word1 這個字串,並將該字串取代為 word2 !舉例來說,在 100 到 200 行之間搜尋 vbird 並取代為 VBIRD 則:
『:100,200s/vbird/VBIRD/g』。 摘自 鳥哥的Linux私房菜