Tổng lượt truy cập
Friday, March 2, 2012
Change ID Card Linux
ID Card :
p1p7
p1p5
....
it you wan change ID for ID defaul
Run:
rm /etc/udev/rules.d/70-persistent-net.rules
after:
Reboot
okie, ID card defaul is eth0
-----------
Thursday, February 16, 2012
Fix Error VirtualBox
I have error in Virtualbox, i to do comand :
etc/init.d/vboxdrv setup , all okie . but if alert error:
But : Failed to load VMMR0.r0 (VERR_SUPLIB_WORLD_WRITABLE).
Unknown error creating VM (VERR_SUPLIB_WORLD_WRITABLE).
This line is the answer to all the riddles
00:00:00.533 pdmR3LoadR0U: pszName="VMMR0.r0" rc=VERR_SUPLIB_WORLD_WRITABLE szErr="World writable: '/usr'"
The error is, that your /usr has write permissions for to many people.
you can fix:
- Code: Select all Expand view
-
sudo chmod o-w /usr
Wednesday, February 8, 2012
WINE
What is Wine ?
Different software programs are designed for different operating systems, and most won't work on systems that they weren't designed for. Windows programs, for example, won't run in Linux because they contain instructions that the system can't understand until they're translated by the Windows environment. Linux programs, likewise, won't run under the Windows operating system because Windows is unable to interpret all of their instructions.
This situation presents a fundamental problem for anyone who wants to run software for both Windows and Linux. A common solution to this problem is to install both operating systems on the same computer, known as "dual booting." When a Windows program is needed, the user boots the machine into Windows to run it; when a Linux program is then needed, the user then reboots the machine into Linux. This option presents great difficulty: not only must the user endure the frustration of frequent rebooting, but programs for both platforms can't be run simultaneously. Having Windows on a system also creates an added burden: the software is expensive, requires a separate disk partition, and is unable to read most filesystem formats, making the sharing of data between operating systems difficult.
2. What is Wine, and how can it help me?
Wine makes it possible to run Windows programs alongside any Unix-like operating system, particularly Linux. At its heart, Wine is an implementation of the Windows Application Programing Interface (API) library, acting as a bridge between the Windows program and Linux. Think of Wine as a compatibility layer, when a Windows program tries to perform a function that Linux doesn't normally understand, Wine will translate that program's instruction into one supported by the system. For example, if a program asks the system to create a Windows pushbutton or text-edit field, Wine will convert that instruction into its Linux equivalent in the form of a command to the window manager using the standard X11 protocol.
If you have access to the Windows program's source code, Wine can also be used to recompile a program into a format that Linux can understand more easily. Wine is still needed to launch the program in its recompiled form, however there are many advantages to compiling a Windows program natively within Linux. For more information, see the Winelib User Guide.
3. Wine features
Throughout the course of its development, Wine has continually grown in the features it carries and the programs it can run. A partial list of these features follows:
Support for running Win32 (Win 95/98, NT/2000/XP), Win16 (Win 3.1) and DOS programs
Optional use of external vendor DLL files (such as those included with Windows)
X11-based graphics display, allowing remote display to any X terminal, as well as a text mode console
Desktop-in-a-box or mixable windows
DirectX support for games
Good support for various sound drivers including OSS and ALSA
Support for alternative input devices
Printing: PostScript interface driver (psdrv) to standard Unix PostScript print services
Modem, serial device support
Winsock TCP/IP networking support
ASPI interface (SCSI) support for scanners, CD writers, and other devices
Advanced unicode and foreign language support
Full-featured Wine debugger and configurable trace logging messages for easier troubleshooting
Samba
Samba là một dịch vụ cho phép Windows đọc được các tài nguyên mạng của Linux, Vì Windows share tài nguyên ra mạng theo cơ chế Server Message Block (SMB) nên Linux chơi chữ lấy chữ Samba làm tên service luôn. Trên Linux nếu bạn active dịch vụ Samba thì bạn có thể tạo các share resource mà Windows có thể truy cập được. Rất tiện nếu như chúng ta có nhiều máy tính cùng chạy song song Windows và Linux. Trước đây chưa có Samba, việc chia xẻ các tài nguyên giữa Linux và Windows fải thông wa FTP, mà cấu hình FTP thì hơi nặng hơn so với Samba.
Việc cấu hình Samba thì cũng đơn giản thôi, chỉ cần chỉ ra các user nào trên Windows được phép truy xuất vào các tài nguyên được share, share tài nguyên nào ra mạng, tên workgroup của Samba server và active service lên là xong. Khi đã cấu hình và active xong Samba service, bạn có thể vào Network Neighborhood của Windows để search các tài nguyên trên các máy Linux.
Samba thực chất chứa vài chương trình phục vụ cho những mục đích khác nhau nhưng có liên quan đến nhau. Hạt nhân của samba là hai Daemon co nhiệm vụ sau:
- smbd Chịu trách nhiệm điều khiển các tài nguyên được chia sẻ giữa server samba và các client của nó. Nó cung cấp các dịch vụ về file, in và trình duyệt cho các client SMB thông qua một hay nhiều mạng. smbd sử lý tất cả các trao đổi giữa server samba và các client mạng của nó.
-nmbd : Là một server dịch vụ tên đơn giản bắt chước các chức năng máy chủ dịch vụ tên, chạy với giao thức WIN và NETBIOS. Daemon này lắng nghe các yêu cầu của máy chủ dịch vụ tên và cung cấp các thông tin thích hợp khi được gọi tới . Nó còn cung cấp các danh sách duyệt NetworkNeighbourhood và tham gia vào lựa chọn các đối tượng mạng trong đó.
Giao thức NETBEUI được hãng IBM phát triển vào năm 1985 dựa trên giao thức NETBIOS. nó được thiết kế dùng cho mạng LAN nhỏ và cho phép một máy tính có tên dài đến 15 ký tự. Khi tham gia môi trường mạng thì Mdaemon nmbd của samba sẽ đảm nhận giao tiếp với các máy khác thông qua giao thức NETBEUI. Nhưng khi một máy chạy Unix có tên đầy đủ là sangdv.edu.vn thì NETBEUI chỉ hiểu tên máy đó là sangdv phần 9 byte còn lại là để các ký tự trắng.
Các tập tin cấu hình (hay chính là các lệnh) của SAMBA:
- smbclient: một client của unix theo kiểu ftp, có thể dùng tiện ích này đề kêt nối với tài nguyên được share
- smbtar: Để lưu trữ các tìa nguyên được chia sẻ, tương tự như lệnh tar của unix
- mklookup: Chương trình cung cấp NETBIOS thông qua việc tìm tên bằng TCP/IP
- smbpasswd: Cho phép người quản trị thay đổi mật khẩu đã mã hoá của Samba
- smbstatus : Báo cáo các kết nối mạng hiện thời tới các tài nguyên đuợc chia sẻ trên samba
- testparrm: chương trình đơn giản để làm cho file samba có hiệu lực
Thursday, December 22, 2011
Install Truecrypt Fedora 16
TrueCrypt cho phép bạn tạo ra một đĩa ảo được mã hóa trong một tập tin hoặc biến nó thành một đĩa ảo với một ký tự ổ đĩa.
Bất kỳ tập tin, dữ liệu được lưu trữ trên đĩa này sẽ tự động được mã hóa và chỉ có thể được truy cập nếu bạn cung cấp mật khẩu chính xác hoặc một chìa khóa tương ứng. TrueCrypt hỗ trợ nhiều thuật toán mã hóa như AES-256, Blowfish (448-bit key), CAST5, Serpent, Triple DES, và Twofish với độ bảo mật rất cao.
Bước 1: Download file “truecrypt-7.1-setup-x86” từ link của hay từ website: http://www.truecrypt.org/downloads
Bước 2: Vào “Console” với quyền “root“
Bước 3: Vào thư mục chứa file vừa Download, dùng lệnh “cd /home/letien/Downloads/“
Bước 4: chmod 777 truecrypt-7.1-setup-x86
Bước 5: Dùng lệnh “./truecrypt-7.1-setup-x86” -> Click “Install TrueCrypt” -> Click “I accept and agree…” -> Click “OK“
Bước 5: Nhấn Enter để xác nhận cài đặt thành công.
Nếu cài đặt xong bạn không mout được user thường thì bạn thiết lập sau
|
If I add the line:
ALL= /usr/bin/truecrypt to
the sudoers file this lets all users mount volumes at arbitrary
mount-points. The problem is a user could create a truecrypt volume and
then mount it at /etc/apache2 or /var/www -- directories which they shouldn't be able to tamper with.If a user doesn't have sudo rights to run /usr/bin/truecrypt then truecrypt fails after prompting for the administrator/user password. |
Gỡ bỏ: truecrypt-uninstall.sh
Thursday, November 3, 2011
Linux dùng như windows
- Khi dùng linux để có công cụ sử dụng thường ngày như windows chúng ta cần cài gói sau:
Update Hệ điều hành
yum -y update
Khai báo Proxy cho YUM
Sửa file cấu hình YUM (yum.conf): vi /etc/yum.conf
Thêm vào cuối file dòng khai báo: proxy=http://tên_account_truy_cập_internet:mật_khẩu@địa_chỉ_ip_proxy:8080
Cài đặt Repo (kho chứa) rpmfusion
Tải về: wget http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
Cài đặt: rpm -ivh rpmfusion-free-release-stable.noarch.rpm
Cài đăt công cụ truy cập ổ đĩa NTFS (trong trường hợp có phân vùng NTFS)
Cài đặt
yum -y install ntfs-3g ntfs-config
yum -y install beesu.i686
Cấu hình
ntfs-config (Setup mount ổ NTFS)
Cài đặt Fonts và Bộ gõ tiếng Việt
Cài đặt SCIM
yum -y install scim scim-libs scim-bridge scim-bridge-gtk
Tải về bộ gõ Unikey
Tải về: wget http://scim-unikey.googlecode.com/files/scim-unikey-0.3.1-1.fc13.i386.rpm
Cài đặt: rpm -ivh scim-unikey-0.3.1-1.fc13.i386.rpm
Sau khi cài đặt xong, vào System --> Preferences --> Input Method Selector --> Use Scim (recommened)
Log out và log in lại
Cài đặt Fonts
Tải về: down fonts các trang.
Giải nén: tar –xzvf msttfonts.tar.gz
Copy vào thư mục làm việc: mv msttfonts /usr/share/fonts/
Log out và log in lại.
Cài đặt Thunderbird (eMail-Client)
yum -y install thunderbird (mail client)
Cài đặt Pidgin (IM Client)
Cài đặt: yum -y install pidgin (chat nội bộ)
Sau khi cài đặt xong, vào khai báo trong chương trình
Domain: ip máy chủ pidgin
Port: 5222
Proxy: No Proxy
Cài đặt TigerVNC
Cài đặt: yum -y install tigervnc tigervnc-server
Bật VNC:
vncviewer -listen (hoạt động ở chế độ lắng nghe)
vncserver (hoạt động ở chế độ server)
Cài đặt OpenOffice
yum -y groupinstall “Office/Productivity”
Cài đặt VLC (Media Player)
yum -y install vlc mozilla-vlc gecko-mediaplayer
Cài đặt Java
Tìm kiếm: yum search java
Cài đặt: yum -y install java-1.6.0-openjdk.i686 java-1.6.0-openjdk-plugin.i686
Cài đặt SVN (Subversion)
yum -y install kdesvn
Cài đặt Máy in
Vào System -> Administration -> Printing -> Add để thêm máy in mới
Cài đặt Stardict (phần mềm Từ điển)
Tìm kiếm: yum search stardict
Cài đặt: yum -y install stardict.i686
Tải về CSDL Từ điển: down các từ điển AnhViet. VietAnh, VietViet vào /user/share/stadict/dic
Giải nén: tar -xzvf stardic-AnhViet.tar.gz
Copy vào thư mục làm việc: mv AnhViet/ VietAnh/ VietViet/ /usr/share/stardict/dic
Cài đặt VirtualBox (phần mềm chạy máy ảo)
yum -y install automake autoconf gcc kernel-devel kenel-headers dkms
yum -y install VirtualBox-4.0.i686
Sau khi cài xong
usermod -a -G vboxusers tên_account_đăng_nhập_máy_tính
Cài đặt Flashplayer
Tải về (file yum): http://get.adobe.com/flashplayer/
Cài đặt kho chứa: rpm -ivh adobe-release-i386-1.0-1.noarch.rpm
Cài đặt Flashplayer: yum install nspluginwrapper alsa-plugins-pulseaudio flash-plugin
Cài đặt Rdesktop (Remote Desktop client)
yum -y install rdesktop
Cài đặt Twinkle (Softphone client)
Cài đặt: yum -y install twinkle.i686
Sau khi cài đặt xong, vào khai báo trong chương trình
Domain: Ip server voip
Username: số_SJPhone
Pass: mật_khẩu_SJPhone
Đồng bộ dữ liệu giữa desktop với laptop
Unison là công cụ đồng bộ file cho Unix và Windows. Nó cho phép hai bản sao của một tập các file và thư mục được lưu trên các máy khác nhau (hoặc các đĩa cứng khác nhau trên cùng một máy), được thay đổi tách biệt, sau đó cập nhật bằng cách truyền sự thay đổi trên mỗi bản sao cho bản sao kia (trích giới thiệu trên website của Unison). Đại khái, Unison cho phép bạn đồng bộ nội dung hai thư mục theo cả hai chiều một cách đơn giản nhất. Hỗ trợ giao diện đồ họa GTK và truyền file qua SSH, giờ đây bạn thể đồng bộ dữ liệu của mình từ Linux sang Windows bằng vài thao tác click chuột. Bản đóng gói có sẵn cho cả Linux và Windows có thể tải xuống ở đây và chạy ngay không cần cài đặt. Unison cũng có thể dùng để đồng bộ dữ liệu trên máy tính với đĩa cứng USB để mang đi vác về.
Nguon:http://longld.blogspot.com
Saturday, October 29, 2011
Download best suport Linux.
Vậy trên linux thì sao?. Các bạn có thể sử dụng rất nhiều gói hỗ trợ linux nhưng với tôi skdownloader là số một, giao diện của skdownloader cực kỳ hoàn hảo, giao diện dễ sử dụng, tốc độ không kém so với IDM, FlashGet.
Tham khảo.
http://freshtutorial.com/download-manager-linux/
I used:
SKDownloader
How to install
Download installer using the above download button to your computer (say at /tmp/skdownloader_linux_installer.sh) and run following commands in command line.
> cd /tmp
> su (You will have to provide root password here)
> sh ./skdownloader_linux_installer.sh
Once done, you can run skdownloader by typing "skdownloader" in command line or by clicking on the desktop shortcut.
Monday, October 3, 2011
ACL squid
Squid content filtering: Block / download of music MP3, mpg, mpeg, exec files. For security and to save bandwidth I would like to configure Squid proxy server such way that I do not want my users to download all of the following files:
MP3
MPEG
MPG
AVG
AVI
EXE
How do I configure squid content filtering?
A. You can use squid ACL (access control list) to block all these files easily.
How do I block music files using squid content filtering ACL?
First open squid.conf file /etc/squid/squid.conf:
# vi /etc/squid/squid.conf
Now add following lines to your squid ACL section:
acl blockfiles urlpath_regex "/etc/squid/blocks.files.acl"
You want display custom error message when a file is blocked:
# Deny all blocked extension
deny_info ERR_BLOCKED_FILES blockfiles
http_access deny blockfiles
Save and close the file.
Create custom error message HTML file called ERR_BLOCKED_FILES in /etc/squid/error/ directory or /usr/share/squid/errors/English directory.
# vi ERR_BLOCKED_FILES
Append following content:
Now create /etc/squid/blocks.files.acl file:
# vi /etc/squid/blocks.files.acl
Append following text:
\.[Ee][Xx][Ee]$
\.[Aa][Vv][Ii]$
\.[Mm][Pp][Gg]$
\.[Mm][Pp][Ee][Gg]$
\.[Mm][Pp]3$
Save and close the file. Restart Squid:
# /etc/init.d/squid restart
Squid in action:
Thursday, September 29, 2011
NOTE: Install DNS centos
+Bind-9.2.4-30.el4.i386.rpm ->đây là gói hệ thống
+Bind-chroot-9.2.4-30.el4.i386.rpm ->gói này có vai trò quan trọng trong việc cung cấp tính năng , bảo mật chứng thực cơ sở dữ liệu DNS, khi đã cài gói chroot này thì việc cấu hình được trong file /var/named/chroot/
+Bind-devel-9.2.4-30.el4.i386.rpm -> gói này cung cấp file và thư viện yêu cầu cho sự phát triển của hệ thống.
+Bind-libs-9.2.4-30.el4.i386.rpm -> cung cấp chức năng thư viện trợ giúp cho DNS
+Bind-utils-9.2.4-30.el4.i386.rpm -> cung cấp tiện ích cho DNS server như: nslookup...
+Caching-nameserver-7.3-3.0.1.el4_6.noar -> package cung cấp file mẫu và hỗ trợ cấu hình caching và DNS
Note: DNS centos. By: mysun
1. bind
2. caching-nameserver
3. bind-chroot
You can download this software by this command.Bind-chroot: is file config security
# yum -y install bind caching-nameserver bind-chroot
if we install bind-chroot: all config file path: /var/named/chroot
this is file config primari /var/named/chroot/etc/named.rfc1912.zones
ex: zone "." IN {
type hint;
file "named.ca";
};
zone "localdomain" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};
zone "hacker.vn" IN {
type master;
file "hacker.for";
(mien xuoi)
allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "hacker.rev";
(mien nguoc)
allow-update { none; };
};
hacker.for and hacker.rev path: /var/named/chroot/var/named/
copy tempelate :
cp localhost.zone hacker.for
cp named.local hacker.rev
vi hacker.for:
$TTL 86400
@ IN SOA dns.hacker.vn. root.dns.hacker.vn (
2011030405 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS dns.hacker.vn
dns IN A 192.168.1.200
www IN A 192.168.1.100
IN AAAA ::1
vi hacker.rev:
$TTL 86400
@ IN SOA dns.hacker.vn. root.dns.hacker.vn (
2011030405 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS dns.hacker.vn
.
200 IN PTR dns.hacker.vn
.
100 IN PTR www.hacker.vn
.
vi /etc/resolv.conf:
nameserver 192.168.1.200
vi /var/named/chroot/etc/named.caching-nameserver.conf
listen-on port 53 { 127.0.0.1; 192.168.1.200; };
end.
Friday, June 3, 2011
Monitor Lan Iptraf
+ Đếm tổng số byte IP, TCP UDP, UDP, Non-IP
+ Địa chỉ và port của source và destination
+ Đếm số Byte và số gói tin TCP
+ Trạng thái TCP Flag
+ Thông tin nguồn và đích của gói tin UDP
+ Dịch vụ TCP và UDP trong trạng thái tĩnh
+ Đếm số gói tin đi qua Interface
I/ Cài đặt
- Download bản iptraf version 2.7.0, các tham số mà hệ thống yêu cầu dưới đây được áp dụng cho phiên bản này
- Iptraf chạy trên hệ thống linux với các thông số yêu cầu trước khi cài đặt:
o Linux kernel 2.2.0 or cao hơn
o Thư viện lập trình GNU C Library 2.1(glibc 2.1) or cao hơn
o Trình biện dịch gcc 2.7.2.3 or cao hơn
o Ncurses 4.2 or cao hơn( Thư viện lập trình)
Các câu lệnh kiểm tra cấu hình hệ thống trước khi cài đặt:
Linux kernel : uname –a
Thư viện lập trình GNU C Library: rpm –qa |grep glib
Trình biên dịch gcc: rpm –qa|grep gcc
Kiểm tra Ncurses : rpm –qa|grep ncurses, gồm 2 gói:
ncurses-devel-x.x-x.x
ncurses-x.x-x.x
Kiểm tra đường dẩn database terminfo: /usr/share/terminfo
- Có thể download IpTraf bản mới nhất tại địa chỉ sau: ftp://iptraf.seul.org/pub/iptraf/.
- Các bước cài đặt:
o Sau khi download , gói phần mềm có đuôi là .tar.gz. giải nén vào thư mục hiện thời với câu lệnh sau: tar zxvf iptraf-x.y.z.tar.gz
o Đến thư mục iptraf-x.y.z.tar.gz: cd iptraf-x.y.z
o Biên dịch và cài đặt software, chạy script setup trong thu mục iptraf-x.y.z.tar.gz bằng câu lệnh sau: ./setup
- Các bước cài đặt trên sẽ tạo các file thực thi iptraf nằm trong thư mục usr/local/bin
- Khởi động chương trình : nhập câu lệnh sau : iptraf
*Nếu khi khởi động chương trình xuất hiện thông báo lỗi :Error opening terminal.
Do Khi khởi động iptraf, chương trình tham chiếu đến database terminfo với đường dẩn sau: /usr/share/terminfo, thong báo lỗi trên xuất hiện khi đường dẫn này đã bị thay đổi và cần phải cập nhập lại đường dẫn này bằng cách cập nhật lại biến môi trường:
- Đặt 2 câu lệnh “TERMINFO=/usr/lib/terminfo(thư mục database terminfo), export TERMINFO” vào File /etc/profile
II/ Các config chính
Tại command line nhập iptraf , xuất hiện menu sau
- Chọn Configure, xuật hiện Configure menu
Set on tại các mục sau: Reverse DNS lookup (phân giải ip thành tên miền)
TCP/UDP service name(phân giải port service thành tên)
Color
Logging
Activity mode Kbyte/s
Sau khi tạo filter, phải apply filter, filter mới có hiệu lực.
III/ Các chức năng monitor chính
Có 2 chế độ giám sát thời gian thực
IP Traffic Monitor: ở chế độ này để có thể giám sát được phải khởi động chương trình, nếu tắt màn hình chính thì không thể giám sát đươc cũng như về việc logging, nhưng thông tin rõ ràng , dể hiểu
Background Operation : ở chế độ này, chương trình chạy nền bên dưới hệ thống và log lại , theo mặc định là /var/log/iptraf/ip_traffic-1.log, ta có thể giám sát real time bằng cách xem file log này
Chức năng IP Traffic Monitor : Tại Menu chính của chương trình, chọn dòng IP traffic monitor để giám sát giao thông mạng, tiếp theo Chọn interface cần giám sát: ALL, eth0, eth1 … để capture vác gói tin đi qua trên interface mà ta chọn lựa hoặc sẽ bắt gói tin trên tất cả interface (ALL).
Để thông tin hiện thị rõ ràng dể hiểu, thông tin xem ip nào đã đi những địa chỉ nào, ta nên chọn interface Gateway Lan (eth0 : 10.1.1.1)
Cửa sổ bên trên (Upper window) mô tả giao thông tcp đi qua trên interface, các thông tin hiển thị bao gồm :
o Source address and port
o Packet count
o Byte count
o Source MAC address(invisible)
o Packet Size(invisible)
o Window Size(invisible)
o TCP flag statuses
o Interface
Nhấn phím M để xem các thông tin bị invisible
Cửa sổ bên dưới(Bottom window) : mô tả giao các giao thông khác:UDP, ICMP OSPF, ARP, RARP …
Background operation
Background operation là chức năng cho phép chương trình chạy nền bên dưới của hệ thống và lưu lại vào file log , ta có thể xem file log trong thời gian thực để giám sát giao thông mạng thời gian thực
Nhập câu lệnh theo cú pháp sau :iptraf –i “interface giám sát” –B
ví dụ : Để giám sát interface eth1(Lan interface): iptraf –i eth1 –B
Để giám sát tất cả interface: iptraf –i all –B
Monitor log : tail /var/log/iptraf/ten-file_log -f
- Xử lý và thống kê logging
Dùng chương trình phân tích logging Sawmill Enterprise 7.2.8. Sau khi download về, giải nén, trỏ đến thư mục vừa được giải nén và thực thi file ./sawmill.
Giao tiếp thông qua port 8987: http://x.x.x.x:8987
Sau khi truy cập , config một vài tham số như: update file log để chương trình xử lý, tạo user quản trị, bẻ khóa phần mềm…
Để dữ liệu phân tích vừa sát với thực tế, vừa không làm chậm hệ thống, ta setup chương trình để tự động update database 30 phút một lần.
Iptraf - Ncurses based LAN monitor
IPTraf is a network monitoring utility for IP networks. It intercepts packets on the network and gives out various pieces of information about the current IP traffic over it. Information returned by IPTraf include:
* Total, IP, TCP, UDP, ICMP, and non-IP byte counts
* TCP source and destination addresses and ports
* TCP packet and byte counts
* TCP flag statuses
* UDP source and destination information
* ICMP type information
* OSPF source and destination information
* TCP and UDP service statistics
* Interface packet counts
* Interface IP checksum error counts
* Interface activity indicators
* LAN station statistics
IPTraf can be used to monitor the load on an IP network, the most used types of network services, the proceedings of TCP connections, and others.
Others:
Download the latest version. Once you have it downloaded, move it to /usr/local/src and untar it by running: # tar -zxvf iptraf-3.0.0.tar.gz
To compile and install, just change to the iptraf-3.0.0 top-level directory and type:./Setup
This will automatically compile and install the software and install the binaries into /usr/local/bin so make sure that directory is in your PATH.
The traditional way to do it ..
I try install yum Iptraf
Thursday, June 2, 2011
lập trình in Centos
To install Eclipse on CentOS, run the following command as root:
yum install eclipse-*
After the installation, Eclipse has been created in the Application->Programming.
Posted by Patrick Wong at 8:29 PM
Config Samba in centos
Xây dựng 1 máy ảo Linux chạy hệ điều hành CentOS-5 và 1 máy thật Windows kết nối theo mô hình trên.
Cài đặt và cấu hình máy Linux làm Samba Server và Samba Client để chia sẻ file giữa máy Linux với máy Windows và máy Windows với Linux.
Địa chỉ IP sử dụng trong bài thực hành
Máy Linux : 192.168.1.1/24.
Máy Windows : 192.168.1.2/24.
Bước 1 : Đặt địa chỉ IP trên máy Samba Server và máy Windows. Tắt firewall trên máy Samba Server
[root@sambaserver]# ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up
[root@sambaserver]# service iptables stop
Bước 2 : Kiểm tra package “samba” đã được cài đặt hay chưa. Nếu chưa tiến hành cài đặt package này qua yum hoặc rpm
[root@sambaserver]# rpm -qa | grep samba
[root@sambaserver]# yum install samba
[root@sambaserver]# rpm -qa | grep samba
samba-3.0.33-3.29.el5_5.1
samba-common-3.0.33-3.29.el5_5.1
Bước 3 : Mở file cấu hình tổng thể của samba và xem một số thông tin cấu hình chính.
[root@sambaserver]# less /etc/samba/smb.conf
...
[global] # phần cấu hình tổng thể cho dịch vụ
# ----------------------- Network Related Options -------------------------
workgroup = MYGROUP # gia nhập vào workgroup có tên “MYGROUP”
server string = Samba Server Version %v # thông tin mô tả server
# --------------------------- Logging Options -----------------------------
#
# Log File let you specify where to put logs and how to split them up.
; log file = /var/log/samba/%m.log # Vị trí đặt log file
# max 50KB per log file, then rotate
; max log size = 50
# ----------------------- Standalone Server Options ------------------------
security = user # Xác thực dựa trên user account
passdb backend = tdbsam # Sử dụng tdbsam (smbpasswd) để xác thực
[homes] # Chia sẻ thư mục home của từng người dùng
comment = Home Directories # Thông tin mô tả thư mục
browseable = no # Không hiển thị thư mục này khi browse
writable = yes # Cho phép user ghi file lên thư mục home
; valid users = %S # Giới hạn truy cập cho từng user, %S sẽ được thay thế bằng tên của user truy nhập
; valid users = MYDOMAIN\%S
[printers] # Chia sẻ các máy in
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes
...
Bước 4 : Tạo thư mục chia sẻ trên máy Samba Server và copy 1 số file vào thư mục đó.
[root@sambaserver]# mkdir /smbsharing
[root@sambaserver]# cp /var/log/*.log /smbsharing
Bước 5 : Tạo user có tên “sambauser" trên hệ thống và đưa user này vào danh sách user của samba.
[root@sambaserver]# useradd sambauser
[root@sambaserver]# smbpasswd -a sambauser
New SMB password:
Retype new SMB password:
[root@sambaserver]# chmod 600 /etc/samba/smbpasswd
Bước 6 : Backup file cấu hình của samba và cấu hình file cấu hình này để :
Chỉ cho phép các client ở subnet 192.168.1.0/24 được truy cập vào thư mục chia sẻ.
Chia sẻ thư mục /smbsharing và chỉ cho phép user “sambauser” truy cập vào thư mục chia sẻ này.
[root@sambaserver]# cd /etc/samba
[root@sambaserver]# cp smb.conf smb.conf.backup
[root@sambaserver]# vi /etc/smb.conf
…
host allow 127. 192.168.1.
[myshare]
comment = Shared Folder
path = /smbsharing
browseable = yes
public = yes
writeable = yes
valid users = sambauser
Bước 7 : Kiểm tra file cấu hình và khởi động dịch vụ samba.
[root@sambaserver]# testparm /etc/samba/smb.conf
[root@sambaserver]# service smb start
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
Bước 8 : Trên máy ảo Windows truy cập vào địa chỉ \\192.168.1.1 và login bằng account "sambauser" để xem thư mục chia sẻ.
Bước 9 : Trên máy Windows thử tạo 1 file hoặc folder trong thư mục chia sẻ /smb/sharing. Mặc định thì việc tạo file/folder này sẽ không thành công.
Bước 10 : Trên máy Samba Server thay đổi lại quyền trên thư mục chia sẻ /smbsharing, thêm quyền ghi cho các user khác trên thư mục này.
[root@sambaserver]# ls -l /smbsharing
[root@sambaserver]# chmod o+w /smbsharing
drwxr-xrwx 2 root root 4096 Mar 22 01:36 smbsharing
Bước 11 : Trên máy Windows thử lại tạo 1 file/folder trong thư mục chia sẻ /smbsharing và việc tạo 1 file/folder sẽ thành công.
Mặc định thư mục share nằm trong /home/thư mục share.
CÀI ĐẶT VÀ CẤU HÌNH SAMBA CLIENT
Bước 12 : Kiểm tra package “samba-client” đã được cài đặt trên máy ảo Samba Server ra chưa. Nếu chưa tiến hành cài đặt package này qua yum hoặc rpm.
[root@sambaserver]# rpm -qa | grep samba-client
[root@sambaserver]# yum install samba-client
[root@sambaserver]# rpm -qa | grep samba-client
samba-client-3.0.33-3.29.el5_5.1
Bước 13 : Trên máy ảo Windows tạo thư mục C:\myshare, tạo 1 số file/folder trong thư mục này và chia sẻ thư mục này.
Bước 14 : Trên máy ảo Samba Server tạo 1 mount point và thực hiện việc mount thư mục chia sẻ từ máy Windows. Kiểm tra việc mount.
[root@sambaserver]# mkdir /mnt/smb
[root@sambaserver]# mount -o username=Administrator,password=yourpassword //192.168.1.1/myshare /mnt/smb
[root@sambaserver]# mount
//192.168.1.1/myshare on /mnt/smb type cifs (rw,mand)
[root@sambaserver]# ls /mnt/smb
Hình này đã được thu nhỏ, nhấn vào đây để xem nguyên bản. Kích thước ban đầu của ảnh này là 745x510
Bước 15 ( Tùy chọn ) : Tạo 1 file chứa thông tin về account username và password login vào máy Windows. Cấu hình file /etc/fstab để tự động mount thư mục chia sẻ mỗi khi hệ thống khởi động.
[root@sambaserver]# vi /etc/samba/cred
username=Administrator #username sử dụng để login
password=mypassword #password sử dụng để login
[root@sambaserver]# vi /etc/fstab
…
//192.168.1.1/myshare /mnt/share cifs credentials=/etc/samba/cred 0 0
Wednesday, June 1, 2011
Openldap centos
Sunday, May 22, 2011
Install ssmtp centos
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
After activating the ‘Extra Packages for Enterprise Linux’ repository, you can install sSMTP:
yum install ssmtp
Configuration is rather simple. Just change the following values in your /etc/ssmtp/ssmtp.conf
# The person who gets all mail for userids < 500 # Make this empty to disable rewriting. root=youraccount@googlemail.com # The place where the mail goes. The actual machine name is required # no MX records are consulted. Commonly mailhosts are named mail.domain.com # The example will fit if you are in domain.com and your mailhub is so named. mailhub=smtp.googlemail.com:465 [...] # Set this to never rewrite the "From:" line (unless not given) and to # use that address in the "from line" of the envelope. FromLineOverride=YES # Use SSL/TLS to send secure messages to server. UseTLS=YES [...] AuthUser=YOURACCOUNT AuthPass=PASSWORD You can test by sending a mail to user@domain.tld # echo test | mail -s "testing ssmtp" user@domain.tld Resources and further reading: http://www.boristheengineer.co.uk/slug/configuring_ssmtp.htm http://www.destr0yr.com/article.php/Gmail_and_sSMTP IF ERRORS
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID db42a60e
Public key for autoconf-2.59-5.noarch.rpm is not installed
This errors occurs sometime with yum install the old GPG keys are obsolote, you have to update them :
rpm --import /etc/pki/rpm-gpg/RPM*
Thursday, May 19, 2011
Cai FTP tren centos
cách cài đặt dịch vụ ftp trên centosCách cài đặt FTP Server trong CentOS
Kiểm tra bạn đã cài vsftpd chưa bằng dòng lệnh.
[root@localhost ~]# yum list installed | grep ftp
Nếu bạn thấy chữ vsftpd thì có nghĩa là ftp server đã được cài đặt trong CentOS. Nếu chưa bạn tiếp tục gõ lệnh:
1. Lệnh để cài VSFTP
# yum install vsftpd
2. Thêm dịch vụ VSFTPD vào chkconfig
# chkconfig vsftpd on
3. Khởi động dịch vụ FTP
# service vsftpd start
4. Sau khi khởi động dịch vụ the vsftpd hãy thử kết nối ftp:
# ftp localhost
5. Bạn sẽ nhận được thông điệp đăng nhập với localhost:root
[root@localhost ~]# ftp localhost
Connected to localhost.localdomain.
220 (vsFTPd 2.0.5)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (localhost:root):
6. Nếu bạn cố gắng truy cập với quyền root, bạn sẽ nhận được thông báo không truy cập được do quyền bị từ chối
Name (localhost:root): root
530 Permission denied.
Login failed.
Cách khắc phục (Không khuyến khích áp dụng trên các máy chủ dịch vụ đang hoạt động kinh doanh)
Mặt định truy cập FTP sẽ cấp tài khoản root. Để có thể truy cập bằng tài khoản root ta phải xóa tài khoản root từ tập tin user_list và ftpusers bên trong thư mục /etc/vsftpd
Bạn dùng chương trình vi để sửa tập tin user_list và ftpusers.
[root@localhost ~]# vi /etc/vsftpd/user_list
[root@localhost ~]# vi /etc/vsftpd/ftpusers
Sau khi sửa xong bạn bấm CTRL+C để kết thúc và ghi, thoát khỏi vi bằng cách gõ :wq
Cuối cùng bạn khởi động lại dịch vụ vsftpd
[root@localhost ~]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
[root@localhost ~]#
Giờ bạn có thể kiểm tra kết nối FTP với tài khoản root như dưới đây.
[root@localhost ~]# ftp localhost
Connected to localhost.localdomain.
220 (vsFTPd 2.0.5)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (localhost:root):
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bye
221 Goodbye.
tat cac file chia se trong /var/ftp/pub
Wednesday, May 18, 2011
Install netflow centos
Install Module
#cpan
#install GD
#install GD::Graph
#install GD::Text
Download flow-tools GD and GD::Graph
#cd /usr/local/src
#wget ftp://195.220.108.108/linux/epel/5/x86_64/flow-tools-0.68.5-1.el5.x86_64.rpm
#wget http://search.cpan.org/CPAN/authors/id/L/LD/LDS/GD-2.45.tar.gz
#wget http://search.cpan.org/CPAN/authors/id/B/BW/BWARFIELD/GDGraph-1.44.tar.gz
#useradd flow-tools
#rpm -ivh flow-tools-0.68.5-1.el5.x86_64.rpm –-nodeps
#tar –xf GD-2.45.tar.gz
#cd GD-2.45
#perl Makefile.PL
#make
#make install
#tar –xf GDGraph-1.44.tar.gz
#cd GDGraph-1.44
#perl Makefile.PL
#make
#make install
Install rrdtool
#vi /etc/yum.repos/dag.repo
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
enabled=1
# yum install rrdtool rrdtool-devel ruby-rrdtool
Configure flow-tools
#cd /etc/sysconfig/
#vi flow-capture
flow-capture -V 5 -E 5G -N 3 -w /var/flows/ROUTER 0.0.0.0/10.1.1.90/2055
#vi /etc/init.d/flow-capture
# Add pidfile
OPTIONS="-p /var/flow-tools/flow-capture.pid $OPTIONS"
#cd /var/
#chmod 777 flow-tools
#mkdir –p /var/flow/ROUTER
#/etc/init.d/flow-capture restart
#/etc/init.d/flow-capture status
Download FlowViewer & Installation
#cd /usr/local/src
#wget http://ensight.eos.nasa.gov/FlowViewer/FlowViewer_3.3.1.tar
#tar -xf FlowViewer_3.3.1.tar
#mv FlowViewer_3.3.1 /var/www/cgi-bin/
#cd /var/www/cgi-bin
#chmod 0777 *
#cd FlowViewer_3.3.1
# vi FlowViewer_Configuration.pm
###########################################################################
#
# BEGIN EXECUTABLE STATEMENTS
#
# Path variable
$ENV{PATH} .= ':/usr/local/bin:/usr/sbin';
# Server
$FlowViewer_server = "100.100.100.10"; # (IP address or hostname)
# Service
$FlowViewer_service = "http"; # (http, or https)
# Directories and Files:
$reports_directory = "/var/www/FlowViewer";
$reports_short = "/FlowViewer";
$graphs_directory = "/var/www/FlowGrapher";
$graphs_short = "/FlowGrapher";
$tracker_directory = "/var/www/FlowTracker";
$tracker_short = "/FlowTracker";
$cgi_bin_directory = "/var/www/cgi-bin/FlowViewer_3.3.1";
$cgi_bin_short = "/cgi-bin/FlowViewer_3.3.1";
$work_directory = "/var/www/cgi-bin/FlowViewer_3.3.1/Flow_Working";
$work_short = "/cgi-bin/FlowViewer_3.3.1/Flow_Working";
$save_directory = "/var/www/FlowViewer_Saves";
$save_short = "/FlowViewer_Saves";
$names_directory = "/var/www/cgi-bin/FlowViewer_3.3.1";
$filter_directory = "/var/www/cgi-bin/FlowViewer_3.3.1/FlowTracker_Files/FlowTracker_Filters";
$rrdtool_directory = "/var/www/cgi-bin/FlowViewer_3.3.1/FlowTracker_Files/FlowTracker_RRDtool";
$flow_data_directory = "/var/flows";
$exporter_directory = "/var/flows/all_routers";
$flow_bin_directory = "/usr/bin";
$rrdtool_bin_directory = "/usr/bin";
$actives_webpage = "index.html";
$trackings_title = "FlowViewer Saves";
$user_logo = "Generic_Logo.jpg"; # For a nice look make your logo 86 pixels high
$user_hyperlink = "/FlowViewer_Saves";
# General parameters
$version = "3.3.1";
$no_devices_or_exporters = "N";
@devices = ("ROUTER");
#@exporters = ("192.168.100.1:New York Router","192.168.100.2:Prague Router");
$flow_capture_interval = (30 * 60);
$flow_file_length = (15 * 60);
$start_offset = (90 * 60); # e.g., 90 minutes ago
$end_offset = (30 * 60); # e.g., 30 minutes ago
$use_even_hours = "Y";
$N = 3;
$use_NDBM = "N";
$pie_chart_default = 0; # 0 = None; 1 = With Others; 2 = Without Others
$number_slices = 6;
$maximum_days = "91";
$remove_workfiles_time = 86400;
$remove_graphfiles_time = 7*86400;
$remove_reportfiles_time = 7*86400;
$time_zone = ""; # If left empty, will use system time zone
$labels_in_titles = "1"; # Set to "1" for labels in Tracker graph titles; "0" off
# Tracking parameters
$log_directory = "/var/www/cgi-bin/FlowViewer_3.3.1";
#for d in `cat FlowViewer_Configuration.pm | grep directory | awk -F \" '{print $2}'`; do mkdir -p $d/; done
#for d in `cat FlowViewer_Configuration.pm | grep directory | awk -F \" '{print $2}'`; do chmod -R a=rwx $d/; done
#cp Generic_Logo.jpg /var/www/FlowViewer/
#cp FlowViewer_Save.png /var/www/FlowViewer/
#cp FlowViewer.png /var/www/FlowViewer_Saves/
#cp FlowViewer_Save.png /var/www/FlowViewer_Saves/
Configure FlowTracker
#cd /var/www/cgi-bin/FlowViewer_3.3.1
#vi flowcap
#!/bin/sh
#
# FlowTracker: Starts all processes concerning FlowTracker
#
# description: This script starts up the the FlowTracker tools (Collector and Grapher)
#
# processname: There is not a single process associated with these
# actions, rather there are multiple processes. This
# script takes care of all of them.
#
# can be restarted by using the following command:
#
# sudo /etc/init.d/FlowTracker restart
RETVAL=0
start() {
echo -n $"Starting FlowTracker processes: "
echo -n "FlowTracker_Collector "
cd /var/www/cgi-bin/FlowViewer_3.3.1
./FlowTracker_Collector &> /dev/null &
RETVAL=$?
echo -n "FlowTracker_Grapher "
cd /var/www/cgi-bin/FlowViewer_3.3.1
./FlowTracker_Grapher &> /dev/null &
RETVAL=$?
echo ""
}
stop() {
echo -n $"Stopping FlowTracker processes: "
RETVAL=0
for p in `pidof perl`
do
ps $p | grep FlowTracker_Collector > /dev/null
if [ $? -eq 0 ]; then
echo -n "FlowTracker_Collector "
kill $p
fi
ps $p | grep FlowTracker_Grapher > /dev/null
if [ $? -eq 0 ]; then
echo -n "FlowTracker_Grapher "
kill $p
fi
done
echo ""
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
;;
esac
exit $RETVAL
#mv flowcap /etc/init.d/FlowTracker
#chmod a+x /etc/init.d/FlowTracker
#vi /etc/cron.d/FlowTracker
## m h dom mon dow user command
5 0 * * * /var/www/cgi-bin/FlowViewer_3.3.1/FlowTracker_Collector &> /dev/null &
5 0 * * * /var/www/cgi-bin/FlowViewer_3.3.1/FlowTracker_Grapher &> /dev/null &
#/etc/init.d/crond restart
#/etc/init.d/FlowTracker restart
#/etc/init.d/httpd restart
To check process FlowTracker
#ps –ax | grep Flow
Simply point your browser at http://your_server_IP_address/cgi-bin/FlowViewer_3.3.1/FlowViewer.cgi
Monday, May 16, 2011
Leaning CentOS
http://www.blogger.com/img/blank.gif
1, http://www.server-world.info/en/note?os=CentOS_5&p=squid&f=4
2, http://erikimh.com
3, http://www.howtoforge.com/howtos/monitoring?from=60
mysun
Install VirtualBox-4.0 trên Centos
Trong bài viết này , chúng ta sẽ hiểu rõ hơn về phần mềm tạo máy ảo Virtual box on Centos 5.5
Trong kho yum của Centos không có hỗ trợ Virtual box vì thế điều đầu tiên ta cần làm là tạo kho cho virtual box
cd /etc/yum.repos.d/
wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
Sau đó cài các gói hỗ trợ này vào
yum install gcc kernel-devel kernel-header
yum install kernel-PAE-devel kernel-headers
Và cuối cùng là cài virtual box thôi
yum install VirtualBox-4.0
Cài xong mún sử dụng được phải add user mình dùng vào group vboxusers
useradd -a -G vboxusers rootl
Thế là ta đã có 1 Soft tạo máy ảo chạy trên linux
Sunday, May 15, 2011
Cài bộ gõ Scim cho CentOS
Mở Terminal, gõ
yum -y install scim scim-libs scim-tables scim-bridge
2. Tải scim input method for vietnamese về
Tải ở đây : http://code.google.com/p/scim-tables-vietnamese-ext/
3. Cài đặt
Vào chuyển con trỏ lệnh đến thư mục vừa mới tải về. Gõ :
tar -zxf scim-tables-vietnamese-ext*.tar.gz
cd scim-tables-vietnamese-ext/
make install
4. Tuỳ chỉnh
System => Preference => Input Method, chọn custom input method, chọn scim.
Logout để scim hoạt động. Vào add thêm bộ gõ Telex trong Scim để gõ telex.