2011年4月24日星期日

[Python] pypcap for python 2.7@win32.xp

pypcap 是pcap在python上的一个封装,但官方网站上的版本只支持python2.5,家里公司机器上的版本都是2.7。在网上搜了一下,没发现特别完整的step by step guide,用mingw自己编了一个,整理记录一下:

I. Package Download
WinPcap installer:         http://www.winpcap.org/archive/
WinPcap WpdPack:       http://www.winpcap.org/archive/
Mingw:                        http://www.mingw.org/
pycap:                         http://code.google.com/p/pypcap/ 
sendpkt:                      http://code.google.com/p/sendpkt/ 
dpkt:                           http://code.google.com/p/dpkt/ 
pexports:                     http://www.emmestech.com/moron_guides/moron1.html

II. Compile
1> Install Mingw
     <> : install
     <> : under ..\bin, change mingw32-make.exe to make.exe
     <> : add into env variable
     <> : check with g++

2> Install winpcap
     <> : install

3> Generat libpython27.a (for mingw usage)
     <> : goto <Python Home>\libs
     <> : run pexports %dll_name% >%def_file%
            Sample : pexports.exe c:\WINDOWS\system32\python27.dll >python27.def
     <> : run dlltool -d %def_file% -l %library% (please do not forget that gcc linker expects library files to have "lib" prefix, e.g. libpython20.a for python20.dll)
            Sample : dlltool -d python27.def -l libpython27.a
4> Compile pypcap
     <> : unzip both pypcap and wdpack into same folder (pypcap 和 wdpack为同级目录 )
     <> : create setup.cfg as below
  1. [build]  
  2. compiler=mingw32  
     <> : python setup.py config
     <> : python setup.py build
     <> : python setup.py install

5> install senddpkt with similiar process
6> verification

     under cmdlie, type python:

  1. >>> import pcap
  2. >>>

III. FAQ

1> ERROR : "couldn't find pcap build or installation directory"
A:    目录结构:
base\
          pypcap
         WpdPack

2>  ERROR : Undefined reference to `_imp___Py_NoneStruct
A:     缺少python2x.a文件,check II. 3

2011年2月9日星期三

zz[Python]python simplejson模块的使用方法

Source Link: http://kejibo.com/python-simplejson/


python安装:easy_install simplejson
导入模块:

import simplejson as json
几个主要函数:dump,dumps,load,loads 带s跟不带s的区别是 带s的是对 字符串的处理,而不带 s的是对文件对像的处理。
json化python字典数据:

json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])

'["foo", {"bar": ["baz", null, 1.0, 2]}]'

 print json.dumps("\"foo\bar")
 "\"foo\bar"

sort_keys设置是否排序字典:

print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)
{"a": 0, "b": 0, "c": 0}

创建文件流对象:

from StringIO import StringIO
io = StringIO()

把 json编码数据导向到此文件对象:

json.dump(['streaming API'], io)
取得文件流对象的内容:

io.getvalue()
'["streaming API"]'

压缩编码:

import simplejson as json
json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
'[1,2,3,{"4":5,"6":7}]'

美化打印:

import simplejson as json
s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent='    ')
print '\n'.join([l.rstrip() for l in  s.splitlines()])
{
    "4": 5,
    "6": 7
}

解析json字符串:

obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj
True
json.loads('"\\"foo\\bar"') == u'"foo\x08ar'
True
from StringIO import StringIO
io = StringIO('["streaming API"]')
json.load(io)[0] == 'streaming API'
True

指定json解析后的对象:

import simplejson as json
def as_complex(dct):
    if '__complex__' in dct:
        return complex(dct['real'], dct['imag'])
    return dct

json.loads('{"__complex__": true, "real": 1, "imag": 2}',
    object_hook=as_complex)
(1+2j)
from decimal import Decimal
json.loads('1.1', parse_float=Decimal) == Decimal('1.1')
True

指定编码对象的格式:

import simplejson as json
def encode_complex(obj):
    if isinstance(obj, complex):
        return [obj.real, obj.imag]
    raise TypeError(repr(o) + " is not JSON serializable")

json.dumps(2 + 1j, default=encode_complex)
'[2.0, 1.0]'
json.JSONEncoder(default=encode_complex).encode(2 + 1j)
'[2.0, 1.0]'
''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j))
'[2.0, 1.0]'

2011年1月27日星期四

zz[Iphone/IPAD]How to Install IPA Games With Winscp

source link: http://www.ehow.com/how_7853089_install-ipa-games-winscp.html
 

How to Install IPA Games With Winscp

Installing new programs to your jailbroken device from your computer is a simple process.
Installing new programs to your jailbroken device from your computer is a simple process.
Since the Supreme Court deemed that jailbreaking --- using third-party software to remove manufacturer imposed limitations for your iPhone or iPod Touch --- is legal, many consumers have taken it upon themselves to jailbreak their devices. One of the great parts about jailbreaking is the capability of the device to run third-party applications. Most of these applications can be installed using the device's new software, installed during the jailbreaking process, but they can also be downloaded and installed through a wireless network cable from your computer. To do this, we use a program can WinSCP to install the package (a .IPA file).
Difficulty: Moderately Easy

Instructions

Things You'll Need:

  • Wireless network access for both computer and iPhone/iPod Touch

    Preparation

  1. 1
    Connect your iPhone or iPod Touch and computer to the wireless network. To connect the device, open the "Settings" app, touch "Wi-Fi" and select your network.
  2. 2
    Download and install WinSCP, if you haven't already. WinSCP is a free FTP (file transfer protocol) client for Windows that allows you to access and modify the internal files of the device safely.
  3. 3
    Open Cydia (installed when you originally jailbroke the device) on your iPhone or iPod Touch. Go to "Sources", then select "Manage" and "Add Source" and type "http://cydia.hackulo.us" without the quotations.
  4. 4
    Install the package titled Installous using Cydia from the "Packages" menu. This makes installing downloaded apps simple. Also install OpenSSH from Cydia in the same manner. This allows your computer to connect to your iPhone or iPod Touch.
  5. 5
    Quit Cydia and reboot your iPhone or iPod Touch to finish and secure the installation.
  6. Installation

  7. 1
    Use WinSCP to locate your device on the wireless network. This will allow you to transfer the files between your computer and the device.
  8. 2
    Double-click the device to connect to it. Use the user name "root" and the password "alpine", which are set by default through OpenSSH.
  9. 3
    Navigate through the directories in WinSCP to find "/Private/var/mobile/Library/Downloads." This is the directory that "Installous" will install the .IPA files from.
  10. 4
    Copy the .IPA files that you want to install into this directory. After the move has finished, you can quit WinSCP.
  11. 5
    Open Installous and check the "Downloads" section to find your recently moved .IPA files. Click them and allow them to install. Reboot your iPhone or iPod Touch to apply the changes, and you'll find the files on your device.
SSH, SFTP, SCP for embedded systems Supports SSH client and server

Environmentally friendly, clean, efficient and safe drying systems

Update and Deploy Automatically 100-10,000 Computers w/One Click

Cross Platform Mobile Development Bedrock Developer SDK

Ads by Google

Tips & Warnings

  • Always keep your iPhone or iPod Touch firmware up-to-date by syncing the device with iTunes every now and then.
  • Do not use this or any other method to install any copyrighted or illegal applications.

Photo Credit

wireless image by DXfoto.com from Fotolia.com


Read more: How to Install IPA Games With Winscp | eHow.com http://www.ehow.com/how_7853089_install-ipa-games-winscp.html#ixzz1CIVShKKp

2011年1月26日星期三

[Linux]Using yum to install samba

Part1: install rpm repo 

http://wiki.centos.org/AdditionalResources/Repositories/RPMForge#head-5aabf02717d5b6b12d47edbc5811404998926a1b

 RPMforge for CentOS 5

The default RPMforge repository does not replace any CentOS base packages. In the past it used to, but those packages are now in a separate repository (rpmforge-extras) which is disabled by default.
You can find a complete listing of the RPMforge package packages at http://packages.sw.be/
Download the rpmforge-release package. Choose one of the two links below, selecting to match your host's architecture. If you are unsure of which one to use you can check your architecture with the command uname -i
The preferred rpmforge-release package to retrieve and to install in order to enable that repository is one of the two listed above.
Install DAG's GPG key
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
Verify the package you have downloaded
rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
<!> Security warning: The rpmforge-release package imports GPG keys into your RPM database. As long as you have verified the md5sum of the key injection package, and trust Dag, et al., then it should be as safe as your trust of them extends.
Install the package
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
This will add a yum repository config file and import the appropriate GPG keys.
Then try to install something like this
yum install htop
 

Part 2: Install Samby with yum


http://www.ihao.org/dz5/thread-228-1-2.html


在我們使用 Windows 作為客戶機的時候,通常有文件、印表機共享的需求。作為Windows 的網路功能之一,通常可以在 Windows 用戶端之間通過 Windows Network 固有的功能實現這些要求。然而,通過 Samba 我們也可以讓一臺 CentOS 主機來兼容 Windows 網路,實現同樣的功能,進而充分發揮 CentOS 主機的可用性。

本篇文檔主要介紹怎樣通過 Samba 服務器的構建實現 Windows 網路中的文件共享。


安裝 Samba

首先,通過 yum 來在線安裝 Samba 。

[root@sample ~]# yum -y install samba ← 安裝 Samba
Setting up Install Process
Setting up repositories
update 100% |=========================| 951 B 00:00
base 100% |=========================| 1.1 kB 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 73 kB 00:00
update : ################################################## 212/212
Added 212 new packages, deleted 0 old in 4.94 seconds
primary.xml.gz 100% |=========================| 569 kB 00:00
base : ################################################## 1500/1500
Added 1500 new packages, deleted 0 old in 28.97 seconds
primary.xml.gz 100% |=========================| 157 B 00:00
Added 0 new packages, deleted 0 old in 0.03 seconds
primary.xml.gz 100% |=========================| 32 kB 00:00
extras : ################################################## 124/124
Added 124 new packages, deleted 0 old in 1.93 seconds
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for samba to pack into transaction set.
samba-3.0.10-1.4E.9.i386. 100% |=========================| 101 kB 00:00
---> Package samba.i386 0:3.0.10-1.4E.9 set to be updated
--> Running transaction check
--> Processing Dependency: samba-common = 0:3.0.10 for package: samba
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for samba-common to pack into transaction set.
samba-common-3.0.10-1.4E. 100% |=========================| 37 kB 00:00
---> Package samba-common.i386 0:3.0.10-1.4E.9 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
samba i386 3.0.10-1.4E.9 base 13 M
Installing for dependencies:
samba-common i386 3.0.10-1.4E.9 base 5.0 M
Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 18 M
Downloading Packages:
(1/2): samba-common-3.0.1 100% |=========================| 5.0 MB 00:04
(2/2): samba-3.0.10-1.4E. 100% |=========================| 13 MB 00:11
warning: rpmts_HdrFromFdno: V3 DSA signature: NOKEY, key ID 443e1821
Public key for samba-common-3.0.10-1.4E.9.i386.rpm is not installed
Retrieving GPG key from
http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
Importing GPG key 0x443E1821 "CentOS-4 key <centos-4key@centos.org>"
Key imported successfully
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: samba-common ######################### [1/2]
Installing: samba ######################### [2/2]
Installed: samba.i386 0:3.0.10-1.4E.9
Dependency Installed: samba-common.i386 0:3.0.10-1.4E.9
Complete!

配置 Samba
然後,通過編輯 /etc/samba/smb.conf ,根據需求配置 Samba。在這裡,本文的原則是隻將文件共享應用於內網,並讓將要被共享的目錄擁有充分的讀寫權限屬性。
[root@sample ~]# vi /etc/samba/smb.conf ← 編輯 Samba 的配置文件
#======================= Global Settings =====================================
[global]
← 找到這一行(全局設置標簽),在此行下面添加如下行:
dos charset= big5 ← 將 Windows 客戶端的文字編碼設置為簡體中文 GB2312
unix charset= big5 ← 指定 Samba 所在的 CentOS 服務端新建文件或目錄時的編碼為 GB2312
display charset= big5 ← 指定使用 SWAT(一種通過瀏覽器控制Samba的工具)時頁面的默認文字編碼
directory mask = 0777 ← 指定新建目錄的屬性(以下4行)
force directory mode = 0777
directory security mask = 0777
force directory security mode = 0777
create mask = 0777 ← 指定新建文件的屬性(以下4行)
force create mode = 0777
security mask = 0777
force security mode = 0777

workgroup = MYGROUP ← 找到此行,將工作組名稱改為 Windows 網絡所定義的工作組名
workgroup = WORKGROUP
← 變為此狀態,這裡以 Windows XP 默認的“WORKGROUP”為例
; hosts allow = 192.168.1. 192.168.2. 127.
← 找到此行,去掉行首的“;”,並制定訪問限制
hosts allow = 192.168.0. 127. ← 變為此狀態,指定內網IP地址及本地,隻允許這兩種情況的訪問

然後在配置文件的末尾填如下幾行,定義公眾共享目錄:
[public]
comment = Public Stuff
path = /home/samba ← 指定共享目錄位置
public = yes
writable = yes ← 賦予共享目錄寫入權限的屬性
接下來,創建將要通過 Samba 共享給 Windows 網絡的專用目錄。
[root@sample ~]# mkdir /home/samba ← 建立共享文件專用目錄

[root@sample ~]#
chown -R nobody. /home/samba
← 設置專用目錄歸屬為 nobody

[root@sample ~]#
chmod 777 /home/samba ← 將專用目錄屬性設置為 777

在進行到服務端的連接之前,需要預先對用於登錄 Samba 的用戶進行設置。這裡我們以 CentOS 中 Samba 標準的 Samba 用戶數據庫管理工具“smbpasswd”為例,創建用於登錄 Samba 的用戶數據。這裡需要注意的一點:用 smbpasswd 創建用戶的前提是,繫統用戶中存在該用戶 -- 在基於繫統用戶之上,纔可以創建該用戶在 Samba 用戶數據庫中的信息。
[root@sample ~]# smbpasswd -a centospub ← 將繫統用戶 centospub(例)加入到 Samba 用戶數據庫

New SMB password: ← 輸入該用戶用於登錄 Samba 的密碼
Retype new SMB password: ← 再次確認輸入該密碼
Added user centospub.

啟動 Samba 服務
在啟動 Samba 服務之前,首先將防火牆設置中 Samba 所用到的端口進行開放。
[root@sample ~]# vi /etc/sysconfig/iptables ← 編輯 iptables 配置文件

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT ← 找到此行,在下面添加如下行:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 137 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 138 -j ACCEPT


[root@sample ~]# /etc/rc.d/init.d/iptables restart ← 重新啟動 iptables ,使新的規則生效
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]

最後,啟動 Samba 服務。
[root@sample ~]# chkconfig smb on ← 設置 Samba 自啟動

[root@sample ~]# chkconfig --list smb ← 確認 Samba 啟動標簽,確認 2-5 為 on 的狀態
smb 0:off 1:off 2:on 3:on 4:on 5:on 6:off

[root@sample ~]# /etc/rc.d/init.d/smb start ← 啟動 Samba 服務
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]


zz[Linux]Installing VMware Tools on CentOS Server

source link: http://www.networknet.nl/apps/wp/archives/43


CentOS how to install VMWare tools?

Mount the iso image on the VMWare guest running the CentOS partition.
The iso file can be found C:\Program Files\VMware\VMware Server\linux.iso if you are running VMWare Server instance.
2007-11-21_155629
Login with VMWare Server Console to CentOS and mount the cdrom
  • mkdir /mnt/cdrom 
  • mount /dev/cdrom /mnt/cdrom 
mount: block device /dev/cdrom is write-protected, mounting read-only
Mount will link the cdrom to the  /mnt/cdrom directory.  Now you can copy the rpm file to /tmp and start the installation process.
  • cp /mnt/cdrom/VMwareTools-1.0.2-39867.i386.rpm /tmp
  • cd /tmp
  • rpm -i /tmp/VMwareTools-1.0.2-39867.i386.rpm
After the file has been installed start the vmware tools perl script
  • vmware-config-tools.pl

zz[Linux]Samba 安裝教學

source link : http://www.ihao.org/dz5/thread-228-1-2.html


在我們使用 Windows 作為客戶機的時候,通常有文件、印表機共享的需求。作為Windows 的網路功能之一,通常可以在 Windows 用戶端之間通過 Windows Network 固有的功能實現這些要求。然而,通過 Samba 我們也可以讓一臺 CentOS 主機來兼容 Windows 網路,實現同樣的功能,進而充分發揮 CentOS 主機的可用性。

本篇文檔主要介紹怎樣通過 Samba 服務器的構建實現 Windows 網路中的文件共享。


安裝 Samba

首先,通過 yum 來在線安裝 Samba 。

[root@sample ~]# yum -y install samba ← 安裝 Samba
Setting up Install Process
Setting up repositories
update 100% |=========================| 951 B 00:00
base 100% |=========================| 1.1 kB 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 73 kB 00:00
update : ################################################## 212/212
Added 212 new packages, deleted 0 old in 4.94 seconds
primary.xml.gz 100% |=========================| 569 kB 00:00
base : ################################################## 1500/1500
Added 1500 new packages, deleted 0 old in 28.97 seconds
primary.xml.gz 100% |=========================| 157 B 00:00
Added 0 new packages, deleted 0 old in 0.03 seconds
primary.xml.gz 100% |=========================| 32 kB 00:00
extras : ################################################## 124/124
Added 124 new packages, deleted 0 old in 1.93 seconds
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for samba to pack into transaction set.
samba-3.0.10-1.4E.9.i386. 100% |=========================| 101 kB 00:00
---> Package samba.i386 0:3.0.10-1.4E.9 set to be updated
--> Running transaction check
--> Processing Dependency: samba-common = 0:3.0.10 for package: samba
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for samba-common to pack into transaction set.
samba-common-3.0.10-1.4E. 100% |=========================| 37 kB 00:00
---> Package samba-common.i386 0:3.0.10-1.4E.9 set to be updated
--> Running transaction check

Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
samba i386 3.0.10-1.4E.9 base 13 M
Installing for dependencies:
samba-common i386 3.0.10-1.4E.9 base 5.0 M
Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 18 M
Downloading Packages:
(1/2): samba-common-3.0.1 100% |=========================| 5.0 MB 00:04
(2/2): samba-3.0.10-1.4E. 100% |=========================| 13 MB 00:11
warning: rpmts_HdrFromFdno: V3 DSA signature: NOKEY, key ID 443e1821
Public key for samba-common-3.0.10-1.4E.9.i386.rpm is not installed
Retrieving GPG key from
http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
Importing GPG key 0x443E1821 "CentOS-4 key <centos-4key@centos.org>"
Key imported successfully
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: samba-common ######################### [1/2]
Installing: samba ######################### [2/2]
Installed: samba.i386 0:3.0.10-1.4E.9
Dependency Installed: samba-common.i386 0:3.0.10-1.4E.9
Complete!

配置 Samba
然後,通過編輯 /etc/samba/smb.conf ,根據需求配置 Samba。在這裡,本文的原則是隻將文件共享應用於內網,並讓將要被共享的目錄擁有充分的讀寫權限屬性。
[root@sample ~]# vi /etc/samba/smb.conf ← 編輯 Samba 的配置文件
#======================= Global Settings =====================================
[global]
← 找到這一行(全局設置標簽),在此行下面添加如下行:
dos charset= big5 ← 將 Windows 客戶端的文字編碼設置為簡體中文 GB2312
unix charset= big5 ← 指定 Samba 所在的 CentOS 服務端新建文件或目錄時的編碼為 GB2312
display charset= big5 ← 指定使用 SWAT(一種通過瀏覽器控制Samba的工具)時頁面的默認文字編碼
directory mask = 0777 ← 指定新建目錄的屬性(以下4行)
force directory mode = 0777
directory security mask = 0777
force directory security mode = 0777
create mask = 0777 ← 指定新建文件的屬性(以下4行)
force create mode = 0777
security mask = 0777
force security mode = 0777

workgroup = MYGROUP ← 找到此行,將工作組名稱改為 Windows 網絡所定義的工作組名
workgroup = WORKGROUP
← 變為此狀態,這裡以 Windows XP 默認的“WORKGROUP”為例
; hosts allow = 192.168.1. 192.168.2. 127.
← 找到此行,去掉行首的“;”,並制定訪問限制
hosts allow = 192.168.0. 127. ← 變為此狀態,指定內網IP地址及本地,隻允許這兩種情況的訪問

然後在配置文件的末尾填如下幾行,定義公眾共享目錄:
[public]
comment = Public Stuff
path = /home/samba ← 指定共享目錄位置
public = yes
writable = yes ← 賦予共享目錄寫入權限的屬性
接下來,創建將要通過 Samba 共享給 Windows 網絡的專用目錄。
[root@sample ~]# mkdir /home/samba ← 建立共享文件專用目錄

[root@sample ~]#
chown -R nobody. /home/samba
← 設置專用目錄歸屬為 nobody

[root@sample ~]#
chmod 777 /home/samba ← 將專用目錄屬性設置為 777

在進行到服務端的連接之前,需要預先對用於登錄 Samba 的用戶進行設置。這裡我們以 CentOS 中 Samba 標準的 Samba 用戶數據庫管理工具“smbpasswd”為例,創建用於登錄 Samba 的用戶數據。這裡需要注意的一點:用 smbpasswd 創建用戶的前提是,繫統用戶中存在該用戶 -- 在基於繫統用戶之上,纔可以創建該用戶在 Samba 用戶數據庫中的信息。

[root@sample ~]# smbpasswd -a centospub ← 將繫統用戶 centospub(例)加入到 Samba 用戶數據庫

New SMB password: ← 輸入該用戶用於登錄 Samba 的密碼
Retype new SMB password: ← 再次確認輸入該密碼
Added user centospub.

啟動 Samba 服務
在啟動 Samba 服務之前,首先將防火牆設置中 Samba 所用到的端口進行開放。
[root@sample ~]# vi /etc/sysconfig/iptables ← 編輯 iptables 配置文件

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT ← 找到此行,在下面添加如下行:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 137 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 138 -j ACCEPT


[root@sample ~]# /etc/rc.d/init.d/iptables restart ← 重新啟動 iptables ,使新的規則生效
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]

最後,啟動 Samba 服務。
[root@sample ~]# chkconfig smb on ← 設置 Samba 自啟動

[root@sample ~]# chkconfig --list smb ← 確認 Samba 啟動標簽,確認 2-5 為 on 的狀態
smb 0:off 1:off 2:on 3:on 4:on 5:on 6:off

[root@sample ~]# /etc/rc.d/init.d/smb start ← 啟動 Samba 服務
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]

zz[Ubuntu]How to Install Dropbox in Ubuntu 10.10 Maverick Meerkat via its Repository

Source: http://www.liberiangeek.net/2010/11/install-dropbox-ubuntu-10-10-maverick-meerkat-repository/


How to Install Dropbox in Ubuntu 10.10 Maverick Meerkat via its Repository

altThis quick tutorial will show you how to install Dropbox in Ubuntu 10.10 Maverick Meerkat via its repository. Installing programs or packages via the repository allows for automatic updates and upgrades. And if you don’t know what Dropbox is, it an online storage service that lets you automatically backup files and folders securely online.

Getting started:

To get started, go to Applications –> Accessories –> Terminal, then copy and paste the line below and press Enter.
sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5044912E
dropbox_mav_upd_8

After that, go to Applications –> Ubuntu Software Center.

dropbox_mav_upd_9

Then click ‘Edit –> Software Sources’.

dropbox_mav_upd_10

Next, select ‘Other Software’ tab and click ‘Add’.

dropbox_mav_upd_11

Then copy and paste the line below and click ‘Add Source’. Close to go back to Software Center.
deb http://linux.dropbox.com/ubuntu maverick main
dropbox_mav_upd_12

Back in Software Center, search for and install dropbox
dropbox
dropbox_mav_upd

When prompted, click ‘Next’

dropbox_mav_upd_1

Then click ‘Start Dropbox’

dropbox_mav_upd_2

Click ‘OK’ to download Dropbox daemon.

dropbox_mav_upd_3

Select the option below and click ‘Forward’.

dropbox_mav_upd_5

Type your Username and password, and click ‘Forward’.

dropbox_mav_upd_6

Dropbox should automatically create a folder in your home directory called ‘Dropbox’.

dropbox_mav_upd_7

To automatically backup your data, put it in the Dropbox folder found in your home folder.

Enjoy! And please come back soon.