2007年6月30日 星期六

不能說的秘密

今天上班中無意聽到的一首 周董 唱的歌曲 不能說的秘密,聽起來還不賴,在此存檔推薦囉!!


MV短版

2007年6月8日 星期五

Cisco password recover

一:先準備一條使用RJ45接頭的連接線,連接Router的Console Port。

二:終端機使用以下設定(不要用Win NT,建議用WinXP.2000.2003)
9600 baud rate
No parity
8 data bits
1 stop bit
No flow control


三:將Router開機,
System Bootstrap, Version 11.3(19)AA, EARLY DEPLOYMENT RELEASE SOFTWARE (fc1)
Copyright (c) 1998 by cisco Systems, Inc.
C2600 processor with 32768 Kbytes of main memory
Main memory is configured to 32 bit mode with parity enabled
看到出現此訊息後,趕緊按下Ctrl+Break送出 Break,就會進到ROMMON Mode。

四:在rommon>下輸入confreg
rommon 1 > confreg
回答下列問題
Configuration Summary
enabled are:
load rom after netboot fails
console baud: 9600
boot: image specified by the boot system commands
or default to: cisco2-C2600

do you wish to change the configuration? y/n [n]: y-------回答Y
enable "diagnostic mode"? y/n [n]:
enable "use net in IP bcast address"? y/n [n]:
disable "load rom after netboot fails"? y/n [n]:
enable "use all zero broadcast"? y/n [n]:
enable "break/abort has effect"? y/n [n]:
enable "ignore system config info"? y/n [n]: y-------回答Y
change console baud rate? y/n [n]:
change the boot characteristics? y/n [n]: y-------回答Y

enter to boot:
0 = ROM Monitor
1 = the boot helper image
2-15 = boot system
[2]: 2-----要選2

五:rommon 2 > reset 重新啟動 Router
六:--- System Configuration Dialog --- Router 會自動進入 Setup 選單
Would you like to enter the initial configuration dialog? [yes/no]:
按 Ctrl-C 中斷 Setup

七:Router 會進入一般模式
Router>enable 進入 Priviledged mode (不需輸入任何密碼)
Router#show startup-config 顯示 NVRAM 裡面的 Startup-Config
(顯示結果省略)

八:將 Startup-Config 載入 DRAM
Router#configure memory

九: 2611#configure terminal----輸入此命令進入設定模式

十:將 enable 的密碼改為 [自訂]
2611(config)#enable secret [自訂]
十一:將 Running-Config 寫回 NVRAM
2611#copy running-config startup-config

十二:
2611#show version
Cisco Internetwork Operating System Software
(中間結果省略)
Configuration register is 0x2142 目前的 Configuration Register 為 0x2142

十三:
2611#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
2611(config)#config-reg 0x2102 將 Configuration Register 改回來
2611(config)#^Z -----Ctrl+Z
2611#
00:01:54: %SYS-5-CONFIG_I: Configured from console by console
2611# reload 重新開機

PS:參考網頁(Cisco)

2007年6月6日 星期三

Mysql command line

設定root密碼:
mysqladmin -u root password 'your.password' ##在share下
登入mysql server:
mysql -u root -p ##務必加上-p參數才可出現輸入password的提示
建立測試資料庫:
create database test;
建立使用者擁有test的權限,並可以由遠端登入:
grant all privileges on test.* to derek@'%' identified by '1234';

#####continue#####

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中出現輸入帳號密碼的頁面。