[Apache] 防盜連,抓圖
Posted on January 19, 2007
| 3 minutes
| 504 words
| appleboy
目前管理 國史館-台灣文獻館,幾台檔案伺服器 裝了 快 1000萬的數位話檔案,如果將來對外開放,將會造成大量被下載 所以我列了下面幾個保護裝置,目前用在館內,我弄了幾個軟體去下載,果然已經被阻擋了 網頁伺服器要支援REWRITE功能
[Read More]Vim 功能介紹
Posted on December 30, 2006
| 2 minutes
| 368 words
| appleboy
Vim 功能時在太多了,搜尋取代,切換視窗,多重編輯都可以 1.如果想複製整篇檔案的文字,利用下面指令
ggVGy
2.切割畫面
:sp filename 會橫項切割兩個視窗來開檔案
:vsp filename 是直項切割視窗.
Ctrl+w 2次則會切換到令一個視窗
fllow mode
:set scb 則會紀錄一邊檔案,記的要把一邊檔案按下page down才可以 這樣相差一頁,才是你想要的
3.去除 ^H ^M
man gcc | col -b > gcc.txt
vi 後 :1,$s/^v^H//g (^v = ctrl + v, ^H = ctrl+h)
sed -i -e 's/^v^H//g' file
[Read More][Linux] 在 windows底下讀寫linux
Posted on December 15, 2006
| 1 minutes
| 162 words
| appleboy
剛剛在ptt看到的,一連串討論 □ XP 認得 ext2/ext3 磁區嗎 ? 裡面有很多文章 寫的不錯,可以提供出來 問題:
想問一下,我有一個移動式硬碟 60G 所以只能format 成 NTFS or ext2/ext3 而在 Linux 下, 目前支援 NTFS 讀寫可能要另外掛 package… 所以想問,那 Windows XP 是否支援 ext2 / ext3 ext3好像不行, 因為剛剛在 Linux 下 format成 ext3了 並備份了一些東東,到進到了Windows XP底下好像認不得了, 想問,ext2 在 Windows XP 底下,OK嗎… xp認得嗎? 解法如下 作者 wyocbu@kkcity.com.tw (wyocbu),
[Read More][Linux] cwRsync [rsync for windows] SSH 加密異地備份
Posted on December 15, 2006
| 1 minutes
| 202 words
| appleboy
這個我找了好久~因為館內用的系統2003server跟前端系統linux,2個是不同的作業系統 但是我每天都有備份linux資料,我想同步到win的server上面,但是這樣就要在win的機器上面架設rsync伺服器跟rsync client套件 所以我找了很久 終於找到了 cwRsync 有client端 跟server端 跟ssh 加密 open ssh server cwRsync – Rsync for Windows 請點選中間的 Download cwRsync Server
下載之後解壓縮,裡面會有一個執行檔,在安裝即可 安裝好之後,去程式集打開 cwrsync server -> 05. Start a Unix BASH Shell 會出現底下畫面
執行之後,會出現一個 cmd 視窗但字元卻是 $ 的。
[Read More][Linux] 備份策略~shell script
Posted on December 10, 2006
| 1 minutes
| 99 words
| appleboy
※ 引述《wenshian.bbs@bbs.wretch.cc (小拓)》之銘言: > 備份檔案時是不是只能每天整個資料夾做備份?! > 可以做到哪些檔案有更新就把那些更新加進備份檔裡面嗎? > 我也想來試試 由linux備份到windows有什麼好建議嗎? > 最好可以不需要FTP上傳,不過如果難易度差很多我還是會考慮~= = 你可以先把 win的硬碟 mount到 linux上面 這樣就不需要用ftp上傳了 當然希望硬碟是fat32格式 這樣你就可以每天備份東西到 win的系統上面了~ 你說 “可以做到哪些檔案有更新就把那些更新加進備份檔裡面嗎?” 我覺得不需要這樣 你可以每天備份 用日期當作檔名 ,然後備份7天 只要超過7天的資料在砍掉,這樣你的備份檔 只會有7天以內的資料
#!/bin/bash
date=`date +%Y-%m-%d`
RETENTION_PERIOD="7"
HEADER="Backup data"
remove_oldfiles(){
echo "Removing directory $1 files older than $RETENTION_PERIOD days" | wall
find $1 -type f -mtime +$2 -exec rm '{}' \;
}
BACKUPDIR="/home/appleboy /var/www/html"
back_www_dir="/backup01/www_data"
#
# 開始備份
#
cd $back_www_dir
for TARGET in $BACKUPDIR
do
echo "
[Read More]MRTG Server performace
Posted on December 5, 2006
| 1 minutes
| 119 words
| appleboy
每次看到 每5分鐘執行 mrtg 的時候, 以root身份去執行它,會使系統瞬間負載增加 就算在好的電腦,我發現在mrtg畫圖的瞬間,還是會使系統負擔,要如何避免這樣呢
The RunAsDaemon keyword enables daemon mode operation. The purpose of daemon mode is that MRTG is launched once and not repeatedly (as it is with cron). This behavior saves computing resourses as loading and parsing of configuration files happens only once. Using daemon mode MRTG itself is responible for timing the measurement intervals. Therfore its important to set the Interval keyword to an apropiate value.
[Read More][Linux] Mrtg 實做 war3 線上人數統計
Posted on November 28, 2006
| 1 minutes
| 128 words
| appleboy
應大家觀眾要求,來寫一下教學 當然我不想怎麼安裝mrtg了,搜尋一下本站就會找到教學 相信mrtg最主要是他的設定檔 cfg檔,先來看看 這個cfg檔怎麼寫
# Created by
# Appleboy 2006/09/25
WorkDir: /usr/local/www/data-dist
Language: big5
Target[bnet_person]: `/usr/local/etc/mrtg/mrtg.person.sh`
MaxBytes[bnet_person]: 10000
Options[bnet_person]: gauge, nopercent, growright
YLegend[bnet_person]: Online Users
ShortLegend[bnet_person]: 人
LegendI[bnet_person]: 線上人數 :
LegendO[bnet_person]: 遊戲數目 :
Title[bnet_person]: 小熊戰網 上線人數統計表
先來解釋 WorkDir: /usr/local/www/data-dist 這個是來存放mrtg統計圖的資料夾,請對應到相關可以放html的資料夾 Target[bnet_person]: `/usr/local/etc/mrtg/mrtg.person.sh` 以下是 mrtg.person.sh 這個檔案 #!/bin/sh
# 這個程式主要在計算有多少人以 bnetd 的方式連線進我們的主機!
# 1. 計算線上的數目
cat /~pvpgn/server.dat | grep "Users" | cut -d "=" -f2
# 2. 計算遊戲數目
cat /~pvpgn/server.
[Read More][Linux,FreeBSD] scp 上傳跟下載
Posted on November 25, 2006
| 1 minutes
| 23 words
| appleboy
上傳:
scp -r -P 2500 /etc/crontab appleboy@hostname.com:/home/appleboy/ 下載:
scp -r -P 2500 appleboy@hostname.com:/home/appleboy/crazy.sql . -r 遞迴 下載 -P ssh port 後面的點 . 你可以換成你想下載到你的哪個目錄
[FreeBSD] 安裝基本mrtg主機流量統計圖
Posted on November 8, 2006
| 1 minutes
| 118 words
| appleboy
主機資訊 FreeBSD 6.1-RELEASE 安裝步驟 cd /usr/ports/net-mgmt/net-snmp; make install clean
cd /usr/ports/net-mgmt/mrtg; make install clean 這2個安裝好,其實基本上就已經可以使用了 在 /etc/rc.conf 加上 snmpd_enable="YES"
snmpd_flags="-a -p /var/run/snmpd.pid"
snmptrapd_enable="YES"
snmptrapd_flags="-a -p /var/run/snmptrapd.pid" 修改 snmpd.conf 檔 目錄在 /usr/local/share/snmp/snmpd.conf com2sec local localhost public com2sec lan 192.168.100.0/24 public group RWGroup v1 local group ROGroup v1 lan view all included .1 80 access RWGroup “” any noauth prefix all all all access ROGroup “” any noauth prefix all none none 紅色部份,盡量不要用 public ,因為這樣別人可以猜到你的mrtg設定 修改好存檔
[Read More][FreeBSD] 安裝 sshit 設定教學
Posted on November 3, 2006
| 1 minutes
| 182 words
| appleboy
系統:FreeBSD 6.0-RELEASE 安裝方式: cd /usr/ports/security/sshit/ make install clean 設定檔 /usr/local/etc/sshit.conf # Sample configuration file of sshit.pl # We use pf as firewall on default 看你喜歡用什麼防火牆,我熟悉ipfw FIREWALL_TYPE = ipfw # Number of failed login attempts within time before we block MAX_COUNT = 3 # Time in seconds in which all failed login attempts must occur WITHIN_TIME = 60 # Time in seconds to block ip in firewall 失敗後禁止登入幾秒鐘 RESET_IP = 300 IPFW_CMD = /sbin/ipfw # Make sure you don’t have any important rules here already IPFW_RULE_START = 2100 IPFW_RULE_END = 3100 IPFW2_CMD = /sbin/ipfw IPFW2_TABLE_NO = 0 PFCTL_CMD = /sbin/pfctl PF_TABLE = badhosts vi /etc/syslog.
[Read More]