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

2012年8月7日

Automatically append version information to the version string

http://blog.lexical.tw/2010/09/configlocalversionautogit-describe.html
http://tw.myblog.yahoo.com/blue-comic/article?mid=-2&prev=715&l=a&fid=1

2012年6月6日

FreeRADIUS Installation on Ubuntu

1. Install Radius Server

sudo apt-get install freeradius

2. configure Radius Server

- configuration file path /etc/freeradius/

radiusd.conf (FreeRADIUS system configuration file)

clients.conf (client authentication configuration file)

client
{
secret =
shortname =
}

client 192.168.1.100{
secret = tseting123
shorename = private-network-1
}

users (cient)
testing Cleartext-Password := "password"



3. start Radius Server

sudo /usr/sbin/freeradius -X



1. 要產生憑證前先確認自己的linux上已經有裝好了openssl

#cd /usr/lib/ssl/misc/

#./CA.pl -newca

Enter PEM pass phrase: 12345 (自行輸入憑證密碼)

Country Name (2 letter code) [AU]:TW

State or Province Name (full name) [Some-State]:Taipei

Locality Name (eg, city) []:Taipei

Organization Name (eg, company) [Internet Widgits Pty Ltd]:ABC

Organizational Unit Name (eg, section) []:DEF

Common Name (eg, YOUR name) []:HIJ

Email Address []:e@e.e

2. 伺服器端認證檔案

#openssl req -new -nodes -keyout srv_key.pem -out srv_req.pem -config ../openssl.cnf

#openssl ca -config ../openssl.cnf -policy policy_anything -out srv_cert.pem -infiles ./srv_req.pem

#cat srv_key.pem srv_cert.pem > srv_keycert.pem

3. 客戶端認證檔案

#openssl req -new -keyout cli_key.pem -out cli_req.pem -config ../openssl.cnf

#openssl ca -config ../openssl.cnf -policy policy_anything -out cli_cert.pem -infiles ./cli_req.pem

#openssl pkcs12 -export -in cli_cert.pem -inkey cli_key.pem -out cli_cert.p12 -clcerts (for XP certificate format)

4. 產生兩個使用tls憑證需要用到的檔案

#openssl dhparam -check -text -5 512 -out dh

#dd if=/dev/urandom of=random count=2

5. 把上述的伺服器端檔案copy到/usr/local/etc/raddb/certs

6.

radiusd.conf: (mark了三行,下面的紅色井字號為mark)

#$INCLUDE sql.conf

#INCLUDE sql/mysql/counter.conf

#$INCLUDE sqlippool.conf

clients.conf:

client 192.168.1.1 {
secret = sodisgood
shortname = sod-ap
}

eap.conf: (修改了一些部分,並且添加了tls憑證部分)

default_eap_type = tls (原本是md5)

private_key_password = 12345 (產生憑證時輸入的密碼)

private_key_file = ${certdir}/srv_keycert.pem (當時後產生的伺服器憑證)

certificate_file = ${certdir}/srv_keycert.pem (同上)

CA_file = ${cadir}/cacert.pem (這個檔案會在demoCA裡面)

dh_file = ${certdir}/dh (tls需要用到的檔案)

random_file = ${certdir}/random (同上)

7. start server

#radiusd -X & (-X是debug mode,&是背景執行)


Ref: http://tec1021.pixnet.net/blog/post/28639573-%E8%BC%95%E9%AC%86%E6%9E%B6%E5%A5%BDradius%E4%BC%BA%E6%9C%8D%E5%99%A8~

2011年2月14日

Makefile

$?: 代表已被更新的 dependencies 的值。也就是 dependencies 中,比 targets 還新的值。
$@: 代表 targets 的值。
$<: 代表第一個 dependencies 的值。
$*: 代表 targets 所指定的檔案,但不包含副檔名。


* make -k: 會讓make在遇到錯誤的時候仍然運行,而不會停在第一個問題
* make -n: 只印出將會進行的工作,而不會真的去執行
* make -f makefile_name: 告訴make需要用那個makefile檔案。當你的make檔不是叫makefile的時候,需要自行透過-f加上你檔案名字,make才找的到你的makefile



Ref:
http://tetralet.luna.com.tw/index.php?op=ViewArticle&articleId=185&blogId=1
http://kevincrazy.pixnet.net/blog/post/29780477
http://hsian-studio.blogspot.com/2008/09/makefile_08.html

2010年11月18日

Allowing Root Logins to Telnet and FTP Services

只要編輯/etc/securetty即可
加入以下就可以讓10個session以root telnet登入
pts/0
pts/1
pts/2
pts/3
pts/4
pts/5
pts/6
pts/7
pts/8
pts/9

Ref: http://www.idevelopment.info/data/Unix/Linux/LINUX_TelnetFTPAsRoot.shtml

2010年8月16日

stdout stderr

1 - denotes stdout ( standard output )
2 - denotes stderr ( standard error )
/dev/null . apparently is null , nothing , empty , zero etc , etc .

2>/dev/null - redirect stderr to nothing , it turns stderr off.

>/dev/null 2>&1 also can write as 1>/dev/null 2>&1 - stdout redirect to /dev/null (no stdout) ,and redirect stderr to stdout (stderr gone as well) . end up it turns both stderr and stdout off

a little practice may help to undstand above .
#ls /usr /nothing
#ls /usr /nothing 2>/dev/null
#ls /usr /nothing >/dev/null 2>&1

2009年5月6日

Linux Shell 下的輸出重定向

Linux Shell 環境中支持輸入輸出重定向,用符號<和>來表示。0、1和2分別表示標準輸入、標準輸出和標準錯誤信息輸出。同時,還可以在這三個標準輸入輸出之間實現重定向,比如將錯誤信息重定向到標準輸出,可以用 2>&1來實現。Linux下還有一個特殊的文件/dev/null,它就像一個無底洞,所有重定向到它的信息都會消失得無影無蹤。如果想要正常輸出和錯誤信息都不顯示,則要把標準輸出和標準錯誤都重定向到/dev/null, 例如:
# ls >/dev/null 2>&1
注意:此處的順序不能更改,否則達不到想要的效果,此時先將標準輸出重定向到 /dev/null,然後將標準錯誤重定向到標準輸出,由於標準輸出已經重定向到了/dev/null,因此標準錯誤也會重定向到/dev/null,於是一切靜悄悄.

Reference
http://blog.daviesliu.net/2005/08/31/200811/

2008年11月12日

[Linux] Install Vmware-tools on Fedora Core 8

Step 1. Install gcc
#yum install gcc

Step 2. Install kernel-devel
#yum install kernel-devel

Step 3. Check if the version number of kernel and the version number of kernel-devel are the same
#uname -r
#rpm -q kernel-devel

Step 4. Upgrade kernel and kernel-devel if their version number showed in in Step 3. are different
#yum -y upgrade kernel kernel-devel
Go to Step 3.

Step 5. Reboot
#init 6

Step 6. Put vmware-tools in running FC8
Removable Devices > CD-ROM > Edit -->
Select Auto detect and check Legacy emulation
VM > Install VMware Tools Install

Step 7. Install vmware-tools
#mount /dev/cdrom /mnt
#cp /mnt/VMwareTools-*.tar.gz /tmp
#cd /tmp
#tar -zxvf VMwareTools-*.tar.gz
#cd vmware-tools-distrib
#./cd vmware-install.pl
...


Reference
http://163.23.24.147/ya/read-287.html
http://hi.baidu.com/sinauc/blog/item/2d393754243636c2b745ae24.html

2008年11月6日

[Linux] Samba on Fedora Core 8

Step 0. Samba Package
samba
samba-client
samba-common


Step 1.
Install Samba
#yum install samba


Step 2.
Configuration
#vi /etc/samba/smb.conf

I. Security Level: Anonymous access
# ==== Global Settings =======
security = share
# ==== Share Definitions =====
[tmp]
comment = Temporary file space
path = /tmp
read only = no
public = yes


II. Security Level: User authentication
# ==== Global Settings =======
security = user
passdb backend = tdbsam
# ==== Share Definitions =====
[homes]
comment = Home Directories
browseable = yes
writable = yes
;valid users = %S
;valid users = MYDOMAIN\%S


Step 3. Parse smb.conf setting in Step 2.
#testparm

Step 4. New a Samba User
(Samba user must be a existing acount)
#useradd SambaUserName
#pdbedit -a SambaUserName

Step 4. Restart Samba Service
#/etc/rc.d/init.d/smb restart

Reference
http://www.mtm.ks.edu.tw/computer/FC5/#samba
http://blog.yam.com/iq180/article/13382018
http://b2d.phc.edu.tw/modules/tadbook2/view.php?book_sn=12&bdsn=697
http://phorum.study-area.org/index.php?action=printpage;topic=53332.0

2008年10月14日

[Linux] Hostname

Step 1.
#hostname NewHostname

Step 2.
#vi /etc/sysconfig/network
HOSTNAME=NewHostname

Step 3.
#vi /etc/hosts
add a new line in the following format
IP NewHostname

2008年9月25日

[Linux] Command

Search
find 路徑 -name 檔案名稱
grep -inr 欲搜尋字串 路徑

Format new disk
command: mke2fs (disk)
#mke2fs /dev/sdc
#mount /dev/sdc /tmp <-- 掛載到/tmp上面