แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - golfreeze

Pages: 1 ... 132 133 [134] 135 136 ... 146
1996
พอดีมี โจทย์มาให้ก็คือ ทำเป็น nat server ครับโดยที่

10.x.x.6 forward packet ทุกport ไปที่ 192.x.x.6
10.x.x.7 forward packet ทุกport ไปที่ 192.x.x.7

แล้วตัว load balance ก็ให้ส่ง packet เข้า
10.x.x.52 ส่ง load ไปที่ 192.x.x.52

เราก็ set ได้ดังนี้
เริ่มต้น ต้องสร้าง ip aliase ไว้ก่อนครับ ผมเลือกใช้เป็น debian เพราะเป็น linux ซึ่งมันใช้งานพวก
network ดีมากๆ อยู่แล้ว
#ifconfig eth0:0 10.x.x.6 netmask x.x.x.x up
#ifconfig eth0:0 10.x.x.7 netmask x.x.x.x up

เสร็จแล้วก็ทำ การเขียน rule ของ nat โดยใช้ iptables ครับ
##ขาเข้ามา
#iptables -t nat -A PREROUTING -j DNAT -i eth0 -d 10.x.x.6 --to 192.x.x.6
#iptables -t nat -A PREROUTING -j DNAT -i eth0 -d 10.x.x.7 --to 192.x.x.7

##ขาออกครับ
#iptables -t nat -A POSTROUTING -j SNAT -o eth0 -s 192.x.x.6 --to 10.x.x.6
#iptables -t nat -A POSTROUTING -j SNAT -o eth0 -s 192.x.x.7 --to 10.x.x.7

ทำการ forward traffic ที่เครื่อง nat server ด้วยนะครับผม
#echo 1 > /proc/sys/net/ipv4/ip_forward
#sysctl -p

1998
SPF (Sender Policy Framework ) เป็นส่วนเสริมของโพรโตคอลรับ-ส่งอีเมล์
ที่ช่วยให้ระบบเมล์ของผู้รับ สามารถตรวจสอบและปฏิเสธการรับเมล์จากแหล่งที่มีการ
ปลอมแปลงชื่อผู้ส่งได้ ซึ่งโดยส่วนใหญ่แล้ว อีเมล์ที่มีการปลอมชื่อผู้ส่งมักจะเป็นสแปม
ทั้งหลายนั่นเอง และเมล์ที่ไม่มีการปลอมแปลงชื่อผู้ส่ง ก็มักจะไม่ใช่สแปม

โดยปกติแล้วโพรโตคอล SMTP จะรับอีเมล์จากผู้ส่งทุกราย ซึ่งง่ายต่อการส่งอีเมล์ขยะ
จากบรรดาผู้ส่งสแปม โดยปลอมแปลงชื่อผู้ส่งเป็นอีกชื่อหนึ่ง ทำให้ยากต่อการตรวจสอบว่า
แท้จริงแล้วเมล์ฉบับนั้นถูกส่งมาจากที่ไหน และสามารถปลอมแปลงชื่อผู้ส่งเป็นบุคคล
ผู้รับให้ความเชื่อถือได้ง่าย เพื่อให้เมล์ฉบับนั้นมีโอกาสถูกเปิดอ่านมากขึ้น

SPF จึงเข้ามามีบทบาทในการกำหนดข้อมูลชนิดพิเศษใน DNS ซึ่งผู้ที่เป็นเจ้าของ
โดเมนสามารถระบุลงไปได้ว่า อีเมล์ที่ส่งจากโดเมนของตน จะถูกส่งออกจากเซิฟเวอร์เครื่องใด
ได้บ้าง เมื่อผู้รับได้รับอีเมล์จากโดเมนดังกล่าว ก็จะตรวจสอบว่าอีเมล์นั้นถูกส่งมาจากหมายเลข
ไอพีที่ระบุไว้จริงหรือไม่ หากไม่อยู่ในรายการไอพีที่ผู้ส่งได้ประกาศไว้
ก็สามารถปฏิเสธการรับเมล์ดังกล่าวได้

ในระบบ Antispam บางระบบอย่าง Spamassassin ไม่ได้ใช้ SPF ในการปฏิเสธการรับอีเมล์
ที่ผิดกฎ SPF โดยทันที แต่ใช้ SPF เป็นเกณฑ์อย่างหนึ่งในการหาค่าความเป็นสแปมของจดหมาย
ซึ่งหากจดหมายฉบับใดตรวจแล้วได้ผลเป็น SPF_PASS ก็จะมีคะแนนความเป็น spam ลดลง
แต่ถ้าจดหมายฉบับได้ได้ผลเป็น SPF_FAIL ก็จะมีคะแนนเพิ่มขึ้น ซึ่งคะแนนนี้จะถูกนำไปรวมกับ
กฎข้ออื่นๆที่ออกแบบไว้ในระบบเพื่อหาคะแนนรวมสุดท้ายเป็นตัวชี้ขาดว่าอีเมล์ฉบับนั้นเป็นสแปมหรือไม่

SPF กำลังเป็นที่นิยมอย่างมากในปัจจุบัน สินค้า Antispam ทั้งในและต่างประเทศต่างก็นำ SPF เข้ามา
ใช้ในระบบ และโฆษณาให้ผู้ซื้อทราบว่าสินค้าของตนมีเทคโนโลยี SPF นี้อยู่ภายใน อย่างไรก็ดี
จากข้อมูลสถิติในระบบ MailCleaner กลับพบว่า อีเมล์ที่ผ่านการตรวจสอบด้วย SPF กลับเป็น
จดหมายขยะจำนวนมากถึง 3800 ฉบับต่อสัปดาห์ จากอีเมล์ที่ผ่านการตรวจสอบด้วย SPF
จำนวน 1 แสนฉบับต่อสัปดาห์ ซึ่งเป็นอัตราที่มากพอสมควรสำหรับกฎที่มีผลถึงขนาดปฏิเสธการรับอีเมล์
สาเหตุที่เป็นเช่นนี้เพราะผู้ส่งสแปมในประเทศไทยจำนวนไม่น้อย ใช้ฟรีอีเมล์ที่มีการกำหนด SPF
ในการส่งสแปม อีเมล์เหล่านี้จึงมาจากเครื่องเซิฟเวอร์ที่ถูกต้องตามหมายเลขไอพีที่ประกาศไว้
ซึ่งพฤติกรรมเช่นนี้แตกต่างกับผู้ส่งสแปมในต่างประเทศที่ใช้วิธีตั้งเมล์เซิฟเวอร์ขึ้นเองเพื่อใช้
ในการส่งสแปมโดยเฉพาะ การใช้ SPF ในต่างประเทศจึงมีประโยชน์ในการป้องกัน spam
ได้มากกว่า ในประเทศไทย นอกจากนี้เมล์ server ในประเทศไทยจำนวนมากก็ยังไม่ได้
ตั้งค่าใน DNS ในส่วนของ SPF ทำให้เมล์ขององค์กรนั้นๆ มีโอกาสถูกตรวจสอบผิดเป็นสแปม
มากขึ้นอีกด้วย

เพื่อให้ SPF สามารถนำมาใช้งานในประเทศไทยอย่างได้ประโยชน์สูงสุด
การรณรงค์ให้เมล์เซิฟเวอร์แต่ละแห่งตั้งค่า SPF ใน DNS เป็นสิ่งที่ควรกระทำควบคู่ไปกับ
การเข้มงวดกวดขันของผู้ให้บริการฟรีอีเมล์ต่างๆ แต่ในมุมมองของผู้ให้บริการป้องกันจดหมายขยะ
ซึ่งอยู่ในฝั่งผู้รับอีเมล์แล้ว การใช้ SPF แบบเต็มที่ตามก้นฝรั่งยังเป็นสิ่งที่ไม่ควรกระทำ
แต่ควรใช้อย่าง ระมัดระวังโดยการปรับลดความสำคัญของกฎที่เกี่ยวข้องกับ SPF ลงมาในระดับหนึ่ง
ให้เหมาะสมกับอัตราความแม่นยำของมัน ณ เวลานี้ หรือเพิ่มข้อกำหนดให้ไม่คิดคะแนน SPF
ให้กับเมล์ที่มาจากฟรีอีเมล์ที่มีผู้ใช้ในการส่งสแปม เป็นต้น

ขอขอบคุณ ข้อมูลจาก เว็บ : http://mailcleaner.in.th/

1999
วันก่อนลง Debian 4.0 เพื่อไปแข่งงาน Airraid ครับ
รายละเอียดที่

http://golfreeze.packetlove.com/guyblog/?p=25#more-25

ขั้นตอนแรกก็ ใส่ sources.list ครับดังนี้

deb http://202.29.6.10/pub/debian/etch main
deb-src http://202.29.6.10/pub/debian/etch main


#deb http://mirror.in.th/debian/etch main
#deb-src http://mirror.in.th/debian/etch main

deb http://202.29.6.10/pub/debian-security/etch/updates main contrib
deb-src http://202.29.6.10/pub/debian-security/etch/updates main contrib

#deb http://ftp.psu.coe.ac.th/debianetch main
#deb-src http://ftp.psu.coe.ac.th/debianetch main

deb http://ftp.thaios.net/debian/etch main
deb-src http://ftp.thaios.net/debian/etch main

----------------------------------------------------------------------------
เริ่มลุยเลย
#apt-get install xorg*
#apt-get install gnome*
#apt-get install xserver-xorg*

เสร็จแล้ว

ถ้าใครได้ใช้ remote-desktop เพื่อจะ remote ต่อไปที่ VNC หรือ remote-desktop ของ window ก็ต้องลง

tsclient ครับ เป็น remote desktop ที่ใช้ใน gnome


#apt-get install tsclient

เลือกใช้ Protocol เป็น RDP สำหรับ remote-desktop ใน window น่ะครับ


และถ้าใครอยากลอง 3ddesktop ที่เป็นหน้าจอ หรูหน่อยก็
#apt-get install 3ddesktop
อิอิ

golfreeze[at]packetlove.com

2000
##Centos by yum

cd /root
wget -nd -vhttp://www.qmailtoaster.org/download/develop/clamav-toaster-0.93.1-1.3.19.src.rpm
yum install rpm-build
yum install bzip2-devel gmp-devel zlib-devel curl-devel libidn-devel
rpmbuild --rebuild --with cnt50 clamav-toaster-0.93.1-1.3.19.src.rpm
mv /usr/src/redhat/RPMS/i386/clamav-toaster-0.93.1-1.3.19.i386.rpm .
rpm -Uhv clamav-toaster-0.93.1-1.3.19.i386.rpm

2001
How to Install Source RPMs

Sometimes the packages you want to install need to be compiled in order to match your kernel
version. This requires you to use source RPM files:

* Download the source RPMs or locate them on your CD collection. They usually have a file
extension ending with (.src.rpm)
* Run the following commands as root:

Compiling and installing source RPMs with Fedora can be done simply with the rpmbuild command

[root@bigboy tmp]# rpmbuild --rebuild filename.src.rpm

Here is an example in which we install the tacacs plus package.

[root@bigboy rpm]# rpmbuild --rebuild tac_plus-4.0.3-2.src.rpm
Installing tac_plus-4.0.3-2.src.rpm
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.61594
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd /usr/src/redhat/BUILD
+ rm -rf tac_plus-4.0.3
+ /usr/bin/gzip -dc /usr/src/redhat/SOURCES/tac_plus-4.0.3.tgz
+ tar -xvvf -
...
...
...
+ umask 022
+ cd /usr/src/redhat/BUILD
+ rm -rf tac_plus-4.0.3
+ exit 0
[root@bigboy rpm]#

The compiled RPM file can now be found in one of the architecture subdirectories under
/usr/src/redhat/RPMS directory. For example, if you compiled an i386 architecture version of the RPM
it will placed in the i386 subdirectory.

You will then have to install the compiled RPMs found in their respective subdirectories as you
normally would.


RPM Installation Errors

Sometimes the installation of RPM software doesn't go according to plan and you need to take
corrective actions. This section shows you how to recover from some of the most common errors
you'll encounter.


Failed Dependencies

Sometimes RPM installations will fail giving Failed dependencies errors which really mean that a
prerequisite RPM needs to be installed. In the next example we're attempting to install the MySQL
database server application, which fails because the mysql MySQL client RPM, on which it depends,
needs to be installed beforehand:

[root@bigboy tmp]# rpm -Uvh mysql-server-3.23.58-9.i386.rpm
error: Failed dependencies:
libmysqlclient.so.10 is needed by mysql-server-3.23.58-9
mysql = 3.23.58 is needed by mysql-server-3.23.58-9
[root@bigboy tmp]#

Installing the MySQL client also fails because it requires the perl-DBD-MySQL package.

[root@bigboy tmp]# rpm -Uvh mysql-3.23.58-9.i386.rpm
error: Failed dependencies:
perl-DBD-MySQL is needed by mysql-3.23.58-9
[root@bigboy tmp]# rpm -Uvh perl-DBD-MySQL-2.9003-4.i386.rpm
error: Failed dependencies:
libmysqlclient.so.10 is needed by perl-DBD-MySQL-2.9003-4
[root@bigboy tmp]#

Strangely enough, the installation of the perl-DBD-MySQL package fails because it needs the mysql
client package. To get around this problem you can run the rpm command with the --nodeps option to
disable dependency checks. In the next example we install the MySQL client ignoring dependencies,
followed by successful installation of perl-DBD-MySQL and mysql-server.

[root@bigboy tmp]# rpm -Uvh --nodeps mysql-3.23.58-9.i386.rpm
Preparing... ####################### [100%]
1:mysql ####################### [100%]
[root@bigboy tmp]# rpm -Uvh perl-DBD-MySQL-2.9003-4.i386.rpm
Preparing... ####################### [100%]
1:perl-DBD-MySQL ####################### [100%]
[root@bigboy tmp]# rpm -Uvh mysql-server-3.23.58-9.i386.rpm
Preparing... ####################### [100%]
1:mysql-server ####################### [100%]
[root@bigboy tmp]#

Note: If all the installation RPMs are located in the same directory, the rpm command can
automatically install all the prerequisite RPMs using the --aid option. One of the advantages of
using the yum facility is that you don't have to worry about this dependency process as much
because the dependency RPMs are always downloaded and installed automatically also.
Signature Keys

Fedora digitally signs all its RPM files, so it's best to import their public encryption key
beforehand so that the RPM installation program will be able to verify the validity of the RPM
file.

This is usually done automatically in newer versions of Fedora, but will need to be done manually in
legacy versions. The manual method uses the rpm command as seen in the next example, but locate the
key files first as their locations can vary between Fedora distributions. It is a good idea to
import both the RedHat and Fedora keys:


[root@bigboy tmp]# locate RPM-GPG-KEY
/usr/share/rhn/RPM-GPG-KEY
/usr/share/rhn/RPM-GPG-KEY-fedora
[root@bigboy tmp]# rpm --import /usr/share/rhn/RPM-GPG-KEY
[root@bigboy tmp]# rpm --import /usr/share/rhn/RPM-GPG-KEY-fedora
[root@bigboy tmp]#

If you don't install the keys you'll get a DSA signature warning that alerts you to the fact
that the RPM file might be bogus:

[root@bigboy tmp]# rpm -Uvh dhcp-3.0pl2-6.16.i386.rpm
warning: dhcp-3.0pl2-6.16.i386.rpm: V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing... #################################### [100%]
1:dhcp #################################### [100%]
[root@bigboy tmp]#

It is always good to install the key files. If they are not there, the RPMs will install with only a
warning message. If the RPM's digital signature doesn't match that in the key file, the rpm
installation program also alerts you and fails to install the RPM package at all:

[root@bigboy tmp]# rpm -Uvh dhcp-3.0pl2-6.16.i386.rpm
error: dhcp-3.0pl2-6.16.i386.rpm: V3 DSA signature: BAD, key ID 4f2a6fd2
error: dhcp-3.0pl2-6.16.i386.rpm cannot be installed
[root@bigboy tmp]#

Signatures are therefore useful because they help protect you against tampered and otherwise
corrupted RPMs being installed.

2002
วันนี้ มี ทริปเรื่องการใช้ งาน tool ในการลง package มาฝากเพื่อนๆ ครับ

เริ่มตั้งแต่ tool ที่ใช้กับ CentOS และ Redhat Enterprise version ต่างๆ น่ะครับ

ซึ่ง tool มีตั้งแต่ Yum , up2date , apt-get สำหรับตัวที่ผมชอบใช้ก็ คือ yum ครับ สำหรับการติดตั้ง
ก็อย่างข้างบน และสำหรับ การลง link นั้นก็คือ
เราต้องหา link ที่เขาเปิดให้เราไป update package มาไว้ในเครื่องครับ ซึ่งเป็นหลักการ ของการ round
robin คล้ายๆ apt-get ใน debian นั่นเอง

เริ่มต้น ก็

#cd /etc/yum.repos.d

สร้างไฟล์ สักตัวขึ้นมา ลงท้ายด้วย .repo

#vi list.repo

ใส่ค่า ในไฟล์ดังนี้ครับ

# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirror.centos.org/centos/4/os/i386/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#released updates
[update]
name=CentOS-$releasever - Updates

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirror.centos.org/centos/4/updates/i386/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
baseurl=http://mirror.centos.org/centos/4/addons/i386/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirror.centos.org/centos/4/extras/i386/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

baseurl=http://mirror.centos.org/centos/4/centosplus/i386/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://mirror.centos.org/centos/4/contrib/i386/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

----------------------------------------------------------------------------------------

ถ้าใครใช้เป็น RHEL5 ก็เปลี่ยน 4 เป็น 5 ด้วยน่ะครับ
แล้วก็ ให้มัน update และลง package ใหม่ โดย
#yum update

ทำการค้นหา package ดังนี้
#yum search

ทำการ update เฉพาะ package xxx ก็
#yum update xxx*

อิอิ
golfreeze[at]packetlove.com

2003
วันนี้ ลองลง yum ดูครับใน redhat 4 enterprise

ก่อนอื่นต้องมี package เหล่านี้ ก่อน

เราต้องโหลดไฟล์มาก่อนครับ ข้อควรปฏิบัติ ควรใช้ ให้เหมาะสมกับ python ที่รองรับ ใน os version นั้นๆ
ด้วยน่ะครับ

Install all the rpms:
rpm -Uvh {all rpm files}

The packages I used are:
yum-2.3.3-1.src.rpm
python-urlgrabber-2.9.6-1.src.rpm
python-sqlite-0.5.0-1.2.el4.rf.i386.rpm
python-elementtree-1.2.6-1.2.el4.rf.noarch.rpm
sqlite-2.8.16-1.2.el4.rf.i386.rpm
python-celementtree-1.0.2-1.2.el4.rf.i386.rpm

สำหรับพวกที่เป็น src.rpm ต้องมา จัดการโดย build มันก่อนครับ ให้มันมีอารมณ์ เหอๆ
#rpmbuild --rebuild {source-rpm-file}

ไฟล์ต่างๆ ผมหาโหลดจากเว็บนี้ ครับ มีครบเลย สำหรับตระกูล แพนกิล

http://dag.wieers.com/rpm/packages/

ลุยเลย

golfreeze[at]packetlove.com

2004
ติดตั้ง rsync และ ssh

# aptitude install rsync ssh

สร้างกุญแจให้กับ ssh

# ssh-keygen -t dsa

Enter file in which to save the key (/root/.ssh/id_dsa): <<<--- [ENTER]
Enter passphrase (empty for no passphrase): <<<--- [ENTER]
Enter same passphrase again: <<<--- [ENTER]
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /home/user1/.ssh/id_dsa.pub.
The key fingerprint is:
cd:43:9b:3a:b1:60:01:ae:a2:0e:f8:00:21:8c:d8:f0 root@server2

คัดลอกกุญแจไปยัง server1

# ssh-copy-id -i /root/.ssh/id_dsa.pub root@server1

ต่อเข้า server1 เพื่อบันทึกรหัสผ่าน 1 ครั้ง

# ssh server1 -l root

The authenticity of host 'server1 (192.168.1.1)' can't be established.
RSA key fingerprint is 1a:d1:12:f4:bd:d4:4c:11:93:55:9c:75:a7:eb:7d:ae.
Are you sure you want to continue connecting (yes/no)? <<<--- yes
Warning: Permanently added 'server1,192.168.1.1' (RSA) to the list of known hosts.
root@server1's password: <<<--- ROOT@SERVER1-PASSWORD
Now try logging into the machine, with "ssh 'root@server1'";, and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

#

ต่อเข้าจริงอีก 1 ครั้ง

# ssh root@server1

Last login: Mon Mar 3 21:02:28 2008 from work1.example.com
Linux server1 2.6.18 #1 Mon Mar 3 13:02:29 ICT 2008 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
No mail.
# exit

(***อย่าลืม exit ออกจาก server1 ด้วยนะครับ***)

เสร็จเรื่อง ssh

ต่อเรื่องทำ rsync
สร้างไดเรกทอรีมารองรับไฟล์จาก server1 สมมุติว่าให้ชื่อ /sys2/server1-sysb

# mkdir -p /sys2/server1-sysb

สร้างไฟล์ d.cron-rsync-server1 ใน /usr/local/sbin

# vi /usr/local/sbin/d.cron-rsync-server1

#!/bin/bash
# IF sys2 IS SEPARATE, MOUNT /sys2 FIRST
#mount /sys2

# RSYNC FROM server1:/sys1/sysb TO /sys2/server1-sysb
rsync -aq --delete -e "ssh -i /root/.ssh/id_dsa"\
root@server1.example.com:/sys1/sysb/ /sys2/server1-sysb/

# IF sys2 IS SEPARATE, MOUNT /sys2 FIRST
#umount /sys2

ทำให้รันได้

# chmod 700 /usr/local/sbin/d.cron-rsync-server1

ตั้ง cron ให้รันตอนตี 1

# crontab -e

...
#BACKUP server1:/sys1/sysb TO /sys2/server1-sysb DAILY
20 1 * * * /usr/local/bin/d.cron-rsync-server1

2005
ทำ rsync แบบไม่ต้องถาม password ครับ

ปกติ ถ้าจะใช้ function auto password ต้องเป็นพวก rsh ครับ

ใช้งานได้เลย

#rsync --password-file=pass blah blah

ส่วนถ้าใครใช้ผ่าน ssh มันต้องถาม password อยู่แล้วครับ แม้จะใส่ option --password-file

เราสามารถแก้ปัญหาโดยการ gen key แล้วส่งไปเครื่องปลายทางได้ครับดังนี้

เช่นผมจะใช้คำสั่ง rsync จากเครื่อง B(CentOS)  ให้โยนไฟล์ไป เก็บไว้ที่ เครื่อง A(debian) ทำได้ดังนี้

ทำการ gen key ที่เครื่อง A (Debian)
#ssh-keygen -t rsa
Enter ค่า default ไปครับ สองครั้ง
ระบบจะทำการ gen file 2 file ให้ดังนี้
id_rsa = private key
id_rsa.pub = public key

ทำการ copy file id_rsa.pub ไปที่เครื่อง B ดังนี้
scp ~/.ssh/id_rsa.pub noisy:.ssh/authorized_keys

แล้วทำการ สั่ง rsync อีกรอบ คราวนี้มันก็จะไม่ถาม password แล้วครับ
BCentOS#rsync -avz -e ssh /home/source/ test@serverA.debian.com:/home/destination/

2006
สำหรับฝั่ง client
Freebsd ครับ
#cd /usr/ports/net/rsync
#make config ดูค่าหน่อย ผมเลือกตาม default เลยครับ
#make install clean

เสร็จแล้วก็ไปเพิ่ม ใน rc.conf ดังนี้
#vi /etc/rc.conf

#Rsync step by golfreeze
rsyncd_enable="YES"

สั่งให้มัน start rsync

#/usr/local/etc/rc.d/rsync start


จัดการลอง sync ตามนี้ครับ
#/usr/local/bin/rsync -avz -e ssh test@server1.example.com:/home/source/ /home/dest/




ถ้าจะให้ดี กันเวลาเน็ตหลุด ก็ลง screen ไปอีกตัวน่ะครับ แล้วเวลาใช้งาน rsync ก็เข้าผ่าน screen ก่อน

#cd /usr/ports/sysutils/screen
#make install clean

#cp /usr/local/sbin/screen /usr/sbin/.
#screen

แล้วเรียกใช้ rsync ตาม command
#/usr/local/bin/rsync -avz -e ssh test@server1.example.com:/home/source/ /home/dest/

เท่านี้ เน็ตหลุด แต่ rsync ไม่หลุด คร๊าบๆๆๆๆๆ


หรือถ้าจะทำการ rsync ผ่าน port ที่ไม่ใช่ port (22) ก็
#rsync -avpog --delete --exclude '/home/test' -e 'ssh -p22999' root@192.168.0.1:/home/source/  /home/dest/

อิอิ
golfreeze[at]packetlove.com
http://www.weloveunix.com

2007
today I would like to show how to use "rsync" in server and client

อิอิ เริ่มต้นด้วยอังกฤษ หน่อยครับ จะได้ฝึกภาษา ด้วย พอดีวันนี้ นั่งเล่นทำ backup ข้อมูลให้
igetweb.com โดยใช้ rsync มาช่วยครับ ซึ่งตัว rsync จะดีกว่า พวก scp ก็คือว่า ถ้าฝั่ง server
มีการลบไฟล์อะไร หรือเพิ่มไฟล์เข้ามามันก็ทำการ sync ให้เรา ดังใจเรา ปราถนา และทำให้ file นั้นสดๆ ใหม่
อีกด้วยอิอิ

เริ่มต้นฝั่ง server ผมใช้เป็น Debian 4.0 ครับ
แล้วฝั่ง client เป็น Freebsd

เริ่มฝั่ง server โดย
ต้องการ syncronize ไดเรคทอรี่ /home/source ของเครื่อง server1.xxx.com
มายังไดเรคทอรี่ /home/dest ของเครื่อง mirror.xxx.com

ทำที่ทั้งสองเครื่อง server1.xxx.com และ mirror.xxx.com
ติดตั้งและปรับแต่ง rsync
# aptitude install rsync
# vi /etc/default/rsync

RSYNC_ENABLE=true

# dpkg-reconfigure rsync
ทำที่เครื่อง server1.example.com
เพิ่มผู้ใช้ชื่อ test
server1:# useradd -m -s /bin/bash test
( -m คือให้คัดลอกรูปแบบจากไดเรคทอรี่ /etc/skel/
-s คือให้ใช้เชลล์คือ /bin/bash )
ทำที่เครื่อง mirror.xxx.com
ทำการคัดลอก
mirror:# rsync -avz -e ssh test@server1.example.com:/home/source/ /home/dest/
<<<--- ใส่ค่า password ของ test

rsync จะทำการคัดลอกไฟล์ทั้งหมดใน /home/source ที่ test มีสิทธิในการอ่านทั้งหมด
มาที่ /home/dest ของเครื่อง mirror

หมายเหตุ
ตรวจสอบเนื้อที่การใช้ไฟล์ด้วยคำสั่ง
# cd /var/www
# du -c | grep total

Ref site : http://www.thaitux.info/node/94

2008
เคยเจอปัญหา card lan จำค่า mac เก่าครับ เลยทำให้ card interface ตัวใหม่ที่แอดเข้าไปนั้น ใช้งานไม่ได้
เพราะ มันจำค่า เก่าของ mac address บน card network นั้นๆ ซึ่งคราวนี้ จะ set ip ใหม่มันไม่ยอมให้
set เราสามารถ เครียร์ config ได้โดย
Debian 4.0 (Etch)
#vi /etc/udev/rules.d/z25_persistent-net.rules

ไฟลฺ์นี้ จะเก็บ ค่า config ของ mac address ของ card network ไว้ครับ
เช่น

1. PCI device 0x14e4:0x1659 (tg3)

SUBSYSTEM=="net", DRIVERS=="?*",
ATTRS{address}=="00:18:8b:f7:e2:fa", NAME="eth0"

1. PCI device 0x14e4:0x1659 (tg3)

SUBSYSTEM=="net", DRIVERS=="?*",
ATTRS{address}=="00:18:8b:f7:e2:fb", NAME="eth1"

เราก็ทำการลบ interface ที่มีปัญหาออกไปซะ แล้วทำการ set ค่า ip interface นั้นใหม่ก็ใช้งานได้แล้วครับ


golfreeze[at]packetlove.com

2009
#####################
#Script FTP to another host.
#####################

#!/bin/sh
HOST="122.122.122.122"
USER="insertlogin"
PASSWD="insertpassword"
FILE="mydatabase.sql"
LOCATION="/Library/Webserver/Websites/localsite/mydatabase.sql"

ftp -n $HOST <<EOF
quote USER $USER
quote PASS $PASSWD

binary
#ดึงไฟล์มา
get  $FILE $LOCATION
#วางไฟล์
put  $FILE $LOCATION
quit
EOF

exit 0

2010
วันนี้ ผมลองรวบรวม trick ในการหา package จากในหัว เล็กๆ ได้คือ

ใน Freebsd
เข้าไปที่
#cd /usr/ports
#make search name=ชื่อpackage

ใน debian
#apt-cache search ชื่อpackage

#หมวกแดง + Centos
#yum search ชื่อpackage

อิอิ
golfreeze[at]packetlove.com

Pages: 1 ... 132 133 [134] 135 136 ... 146