2009年6月23日 星期二

SAMBA建立密碼登入

系統中須先存在使用者
# useradd user
# useradd user1

# smbpasswd -a user1
# 新增使用者user,並要求輸入密碼

# smbpasswd -a user -n
# 新增使用者user,並且使用空白密碼


smb.conf 部份設定內容
----------------
[global]
dos charset = cp950
unix charset = cp950
workgroup = USER
netbios name = SAMBA00
server string = SAMBA-SERVER

#使用者認證
security = share
guest ok = Yes
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd

#關閉印表機
load printers = No
printing = bsd
show add printer wizard = No
disable spoolss = yes


[user]
path = /home/user
browseable = yes
read only = yes ##唯讀
create mode = 0777
directory mode = 0777
veto oplock files = /*.ldb/*.dat/

[user1]
path = /home/user1
browseable = yes
read only = No ##可讀可寫
valid users = user1 ##使用者
create mode = 0777
directory mode = 0777
veto oplock files = /*.ldb/*.dat/

2009年6月15日 星期一

BattleNet會鎖序號!!

駭害不要來列表
1=!xSpeed
2=!xSpeed.Net
3=anti-hack
4=CDKey Grabber
5=Cheatengine speed hack
6=Chicken hack
7=crash hack
8=D2HackIt
9=Diablo 2 bot scripts
10=EasyMap v
11=EasyPlay v
12=Exzap's
13=GearNT
14=Gearnt speedhack
15=hack variant
16=iMap map hack
17=lineage speedhack
18=Map Hack
19=Map_Hack
20=MapHack
21=Map-Hack
22=Monster Map Hack
23=Mousepad's
24=SF W3 CDKey Grabber
25=SF W3/W3X CDKey Grabber
26=ShadowFrench's
27=SpeederXP
28=SpeedGear
29=Sting's Hackmap
30=Teleport hack
31=W3 / W3X MapHack
32=W3 CDKey Grabber
33=W3/W3X CDKey Grabber
34=W3XMapHack
35=W3XMH
36=W3XMH
37=Xliqz's
38=Zerocraft
39=zMaphack
40=Nano maphack
41=Skelletor multi
42=iNHALE
43=Aspeeder

2009年5月12日 星期二

UFW簡易設定

#開啟
ufw disable
ufw default deny
ufw logging OFF
ufw enable
ufw allow 22/tcp
ufw allow proto tcp from 192.168.1.0/24 to 192.168.1.117 port 3260
ufw allow proto tcp from 192.168.1.0/24 to 192.168.1.117 port 20000
ufw allow proto tcp from 192.168.1.0/24 to 192.168.1.117 port 139
ufw allow proto tcp from 192.168.1.0/24 to 192.168.1.117 port 445
ufw allow proto udp from 192.168.1.0/24 to 192.168.1.117 port 137
ufw allow proto udp from 192.168.1.0/24 to 192.168.1.117 port 138


#關閉/刪除 條件
ufw delete allow proto tcp from 192.168.1.0/24 to 192.168.1.117 port 3260
ufw delete allow proto tcp from 192.168.1.0/24 to 192.168.1.117 port 20000
ufw delete allow proto tcp from 192.168.1.0/24 to 192.168.1.117 port 139
ufw delete allow proto tcp from 192.168.1.0/24 to 192.168.1.117 port 445
ufw delete allow proto udp from 192.168.1.0/24 to 192.168.1.117 port 137
ufw delete allow proto udp from 192.168.1.0/24 to 192.168.1.117 port 138

Bonding in Ubuntu

How to Set up Network Bonding in Ubuntu 6.10
Why you may want to do this:
Network Bonding, otherwise known as port trunking allows you to combine multiple network ports into a single group, effectively aggregating the bandwidth of multiple interfaces into a single connection. For example, you can aggregate two gigabyte ports into a two-gigabyte trunk port. Bonding is used primarily to provide network load balancing and fault tolerance. First, we will run two different network tools to check for network connectivity and capability. Run mii-tool to check your interfaces for connectivity:

mii-tool

For our purposes, we will assume you have three interfaces. The result of the mii-tool command is listed below:

eth0: negotiated 100baseTx-HD, link ok
eth1: negotiated 100baseTx-HD, link ok
eth2: negotiated 100baseTx-HD, link ok

Next run ethtool for each interface to check to see what capabilities:

ethtool eth0 && ethtool eth1 && ethtool eth3

The result of the ethtool command is listed below:

Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Half
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: yes

Settings for eth1:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: Unknown! (65535)
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: no

Settings for eth3:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: Unknown! (65535)
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: no

Next, we need to install ifenslave. It’s a simple install:

apt-get update && apt-get install ifenslave

Options for mode types:
You can set up your bond interface according to your needs. In order to do this, you simply change the mode type depicted in the examples below (mode=X). There are seven mode types available. They are as follows:

mode=0

This mode uses the Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.

mode=1

This mode uses an Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode.

mode=2

Transmit based on [(source MAC address XOR'd with destination MAC address) modulo slave count]. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance.

mode=3

Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.

mode=4

IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.

*Pre-requisites:

1. Ethtool support in the base drivers for retrieving the speed and duplex of each slave.

2. A switch that supports IEEE 802.3ad Dynamic link aggregation. Most switches will require some type of configuration to enable 802.3ad mode

mode=5

Adaptive transmit load balancing: channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.

*Prerequisite: Ethtool support in the base drivers for retrieving the speed of each slave.

mode=6

Adaptive load balancing: includes balance-transmit load balancing plus receive load balancing for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bond such that different peers use different hardware addresses for the server.

Now append the following items to your aliases file:

pico /etc/modprob.d/aliases

# Append to the bottom of this file:
alias bond0 bonding
alias eth0 e100
alias eth1 e100
alias eth2 e100
options bonding mode=0 miimon=100

Next, append the following items to your i386 file:

pico /etc/modprob.d/arch/i386

# Append to the bottom of this file:
alias bond0 bonding
options bonding mode=0 miimon=100 downdelay=200 updelay=200

Now we have to modify the interface file. Start off by commenting out any information on the physical interfaces, eth0, eth1, etc, and create a virtual interface such as bond0, configure it similar to below, and be sure to choose a unique hwaddress. Be sure to leave the loopback interface configuration intact.

pico /etc/network/interfaces

It should look something like this:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#auto eth0
#iface eth0 inet static
# address 192.168.0.120
# netmask 255.255.255.0
# network 192.168.0.0
# broadcast 192.168.0.255
# gateway 192.168.0.1
auto bond0
iface bond0 inet static
address 192.168.0.120
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
hwaddress ether 00:03:B3:48:50:2C
post-up ifenslave bond0 eth0 eth1

Save the file and then reboot the system:

shutdown -r now

BASH測試條件

VariableName?=VariableValue? ,指定變數。使用 $VariableName? 來取用變數。
使用 \$$VariableName? 來 在變數前加上 $。
可使用 export VariableName?1 VariableName?2 來當作其它的程式的參數使用。
VariableName?=$Command,指定變數為 Command 執行後的結果。

使用 $0 取得執行的指令名稱 。
使用 $1 取得第一個參數,其餘依此類推。
使用 $# 取得參數的總數。
使用 $? 取得上一個指令的傳回值。
使用 $* 或是 $@ 來得到所有的參數,中間以空白隔開。
使用 $Environment 來 取得環境變數。
read VariableName? , 讓使用者輸入變數的內容。
 
條件測試:

test Expression
echo $?(1 為假,0 為真。和一般的 C 習慣相反。)
 
[Expression]
echo $?
Expression 的類型:

字串運算式,不得使用萬用字元。
String1 = String2 :如果 String1 和 String2 一樣,則回傳值為真。
String1 == String2 :如果 String1 和 String2 一樣,則回傳值為真。
String1 != String2 :如果 String1 和 String2 不一樣,則回傳值為真。
String :如果 String 不是 Null,則回傳值為真。
-n String :如果 String 的長度大於 0,則回傳值為真。
-z String :如果 String 的長度等於 0,則回傳值為真。
數值運算式
integer1 -eq integer2 :如果 integer1 等於 integer2 ,則回傳值為真。
integer1 -ge integer2 :如果 integer1 大於等於 integer2 ,則回傳值為真。
integer1 -gt integer2 :如果 integer1 大於 integer2 ,則回傳值為真。
integer1 -le integer2 :如果 integer1 小於等於 integer2 ,則回傳值為真。
integer1 -lt integer2 :如果 integer1 小於 integer2 ,則回傳值為真。
integer1 -ne integer2 :如果 integer1 不等於 integer2 ,則回傳值為真。
檔案運算式
-d FileName? :若 FileName? 存在,並且為目錄,則回傳值為真。
-f FileName? :若 FileName? 存在,並且為一般檔案,則回傳值為真。
-s FileName? :若 FileName? 存在,並且的長度大於 0,則回傳值為真。
-r FileName? :若 FileName? 存在,並且可讀取,則回傳值為真。
-w FileName? :若 FileName? 存在,並且可寫入,則回傳值為真。
-x FileName? :若 FileName? 存在,並且可執行,則回傳值為真。
-b FileName? :若 FileName? 存在,並且為 block,則回傳值為真。
-c FileName? :若 FileName? 存在,並且為 character,則回傳值為真。
-e FileName? :若 FileName? 存在,則回傳值為真。
-g FileName? :若 FileName? 存在,並且為 set-group-id,則回傳值為真。
-k FileName? :若 FileName? 存在,並且設定了 sticky 字元,則回傳值為真。
-L FileName? :若 FileName? 存在,並且為連結檔,則回傳值為真。
-p FileName? :若 FileName? 存在,並且為 named pipe (FIFO),則回傳值為真。
-S FileName? :若 FileName? 存在,並且為 socket,則回傳值為真。
-u FileName? :若 FileName? 存在,並且為 set-user-id,則回傳值為真。
邏輯運算式
! Expression :如果 Expression 的結果值為假,則回傳值為真。
Expression1 -a Expression1 :將 Expression1 和Expression2 的結果值做And 運算。
Expression1 -o Expression1 :將 Expression1 和Expression2 的結果值做Or 運算。