顯示具有 Linux 標籤的文章。 顯示所有文章
顯示具有 Linux 標籤的文章。 顯示所有文章

2007年6月3日 星期日

Apache 目錄瀏覽權限實做

首先在想要瀏覽的目錄,在httpd.conf 做以下的設定(通常該檔案於 /etc/httpd/conf/httpd.conf)

< directory >
Options -Indexes MultiViews ##取消對目錄的列舉
AuthName "Please input username and password" ##於使用者登入時鍵入帳號密碼的提示訊息
AuthType Basic ##驗證方式
AuthUserFile /var/www/html/mrtg/corner/.htpasswd ##存放帳號密碼的檔案
require valid-user
< /directory >

接下來進行.htpasswd 的創建與使用者帳號密碼的建立


vi .htpasswd ##建立一個密碼檔
htpasswd -c .htpasswd username ##建立使用者與密碼檔 c參數表示建立新檔案
New password: 123456 ##在提示符號後輸入密碼
Re-type new password: 123456 ##再輸入ㄧ次帳號密碼進行確認
Adding password for username ##出現此訊息表示順利建立完成


!ps:另外如果不先自行建立一個.htpasswd檔案,直接用passwd -c建立會有無法順利登入的狀況,不知是不是apache或是版本的緣由!

當上述實做完成,則已經可以順利進行特定目錄的密碼驗證,當然也可以依照httpd.conf的設定檔進行不同木的分權控管,而分權控管的過程中只要不同的目錄裏有相同的使用者名稱與帳號密碼則可以進行不同目錄的存取,而如果不同目錄的存取帳號密碼不同,會在browser中出現輸入帳號密碼的頁面。

2007年4月23日 星期一

Linux-shell

Shell type:
/bin/sh
/bin/bash(default shell)
/bin/ksh
/bin/tcsh(C shell)
/bin/csh
/bin/zsh



~/.bash_history=>
after user logout the history command writed in.


type=>
查詢指令為內部指令(builtin)或是外部指令(file)或是alias
-t-> query "name" type
-p-> if name is command will display fullpath name
-a-> list all match "name" command


entry command => command option parameter

echo,unset=>
$name-> dispaly name content
ex:
name = 1234
echo $name
1234
unset -> cancel $name
Tips
'command' -> 表示可執行的指令
\-> 跳拖字元
export -> 使變數變成環境變數

##continue##

2007年4月16日 星期一

LPIC-系統管理

shutdown:
-c ->to cancel a pending shutdown
-k ->send message
-t ->wait seconds
-f ->skip fsck on reboot


runlevel:
2 ->basic multi-user
1 ->administrator mode ; single mode


syslog.conf:
news ->use net news
auth ->represents login process ;facility represents(象徵,表示) user authentication
cron ->cron daemon
user ->user
mark ->create timestamps in logfile
lpr ->facility represents the line printer


syslog level:
debug->info->notice->warning->err->crit->alert->emerg


lilo:
-u ->uninstall
-d(delay) ->delay seconds before your system to the default kernel
-g ->list the name and location available kernels
read-only ->mount root file system read-only
root ->specify what device should be mounte

2007年3月28日 星期三

MRTG快速架設方式

公司為了觀察使用者使用網路的狀況,而架設MRTG網站使用。
但因為該台主機的I/O流量過於頻繁,造成系統容易crash(個人猜測),因此也只好尋求一個在系統crash後最快速的架設MRTG主機運作方式。

我先將舊的MRTG主機簡稱A,MRTG新主機簡稱B。
首先要取得A中的
/etc/hosts 、/etc/httpd/conf/httpd.conf 、/etc/crontab、/var/www/htm/mrtg/*

取得 /etc/hosts 是為了架設ㄧ模ㄧ樣的主機,讓外部使用者不易察覺。
取得 /etc/httpd/conf/httpd.conf 是為了將MRTG於Apache上的設定路徑與語言選項完全複製。
取得 /etc/crontab 是為了讓MRTG的相關排程可以照原本的設定進行。
取得 /var/www/htm/mrtg/* 將舊有的MRTG資料,如log file等,完全復原。


接著開始進行MRTG軟體的安裝:
安裝前的準備工作:
MRTG 為使用 Perl 程式寫成的,並且使用到 zlib 、 gd 及 png 的函式庫(zlib 用來壓縮圖表、gd 用來繪製圖表),且由於 MRTG 乃使用 SNMP 協定,並且最後是以 HTTP 的網頁型態輸出成圖表,因此,你需要確定 Linux 主機中已經含有下列的套件:
perl (perl-5.0xx 以上)
zlib (zlib-1.1.3-xx 以上)
gd (gd-1.3.xx 以上)
libpng
apache

確定的方法就以 RPM 來確認吧:

rpm -qa grep perl
rpm -qa grep zlib
rpm -qa grep gd
rpm -qa grep libpng


當然若無法確定哪些函式庫是有裝還是沒裝,可以直接用完全安裝來安裝系統:
對於該次安裝我採用REDHAT9用全部安裝,安裝完成後則只需將APACHE啟動即可!
apache的設定檔預設路徑為 /etc/httpd
apache的網頁存放位置預設路徑為 /var/www/html

當已經取得MRTG套件後 mrtg-2.9.17.tar.gz

[root @]# tar -zxvf mrtg-2.9.17.tar.gz
[root @]# cd mrtg-2.9.17
[root @mrtg-2.9.17]# ./configure --prefix=/usr/local/mrtg-2 \
> --with-gd=/usr/include \
> --with-gd-lib=/usr/lib \
> --with-gd-inc=/usr/include \
> --with-png=/usr/include \
> --with-zlib=/usr/include
[root @mrtg-2.9.17]# make; make install
[root @mrtg-2.9.17]# make install


安裝完成後,MRTG的預設執行目錄為
/usr/local/src/mrtg-2/


當MRTG套件安裝完成後,只要記得請動排程,就可以順利運行了。

2007年3月6日 星期二

Iperf 實做,tcp 與 udp 測速

首先於 http://dast.nlanr.net/projects/Iperf/
該網站下載 Iperf Version 2.0.2 的 source code
會出現一個 iperf-2.0.2.tar.gz 的檔案.
接下來為linux上的指令

#mkdir iperfV2
#mv iperf-2.0.2.tar.gz iperfV2
#cd iperfV2#gzip -d iperf-2.0.2.tar.gz (解壓縮)
#tar xvf iperf-2.0.2.tar#cd iperf-2.0.2
#./configure#make#make install-----到此時已經順利安裝完成
#iperf -s 127.0.0.1 (開啟iperf server端程式,使用tcp通訊協定)
#iperf -s 127.0.0.1 -u (開啟iperf server端程式,使用udp通訊協定)

此時server端的軟體已經啟動.
接下來於client端(windows system)在安裝檔的bin目錄下,並於dos視窗中執行
#iperf -c 遠端ip -w 1M (TCP通訊協定)
或是
#iperf -c 遠端ip -w 1M -u (UDP通訊協定)