Access bằng tên miền trong mạng LAN

15 06 2008

Trong mạng LAN nếu ko setting thì chúng ta ko thể access bằng tên miền được mà sẽ bị tự động forward về router. Để setting forward về server ta là như sau:

1. Trường hợp Client là Unix/Linux:

#vim /etc/hosts

thêm vào phía cuối dòng

192.168.0.3  levuhung.com

Trong đó 192.168.0.3 là IP của Server và levuhung.com là tên miền

2. Trường hợp Windows:

Trong ổ C mở Windows –> System32 —> drivers —> etc

Mở file hosts và thêm dòng phía trên vào là được.

Bây giờ mở Firefox lên và gõ http://levuhung.com ^-^





[PHP] Error Report

14 06 2008

 error_reporting(E_ALL|E_STRICT);

ini_set(‘display_errors’,'on’);





[NFS] Linux share

14 06 2008

Để share giữ liệu giữa Linux và Windows chúng ta dùng Samba, còn giữa 2 máy Linux với nhau chúng ta dùng NFS.

Giả sử NFS Server có IP là 192.168.0.3 và folder muốn share là /public

Còn Client có IP là 192.168.0.4 và thư mục mount đến là /public2

1. Setting NFS Server:

#vi /etc/exports
/public 192.168.0.4/24(rw,sync,no_root_squash)

Khởi động NFS:
# /etc/rc.d/init.d/nfs start
Khởi động tự động:
# chkconfig nfs on

Chú ý NFS phụ thuộc portmap nên cũng cần phải khởi động portmap (#service portmap start/#chkconfig portmap on)

Tạo thư mục share:
#mkdir /public

2. Setting Client:
Tạo thư mục share:
#mkdir /public2

Mount:
#mount -t nfs 192.168.0.3:/public /public2

Mount tự động:
#vi /etc/fstab
Thêm vào dòng:
192.168.0.3:/public /public2 nfs rw 1 2




Gmail and Evolution

14 06 2008

for receiving:
server: pop.gmail.com
username: username@gmail.com (must include @gmail.com)
use ssl connection: always
authentication type: password

for sending:
server type: smtp
host: smtp.gmail.com:587
server requires authentication: yes
use secure authentication: whenever possible
authentication type: plain
username: username@gmail.com (must include @gmail.com)





[Error Report][FTP Server]

13 06 2008

Error 1:

[hungdiem@localhost ~]$ ftp 192.168.0.3
Connected to 192.168.0.3 (192.168.0.3).
220 Welcome to Le Vu Hung FTP service.
Name (192.168.0.3:hungdiem): hungdiem
331 Please specify the password.
Password:
500 OOPS: could not open chroot() list file:/etc/vsftpd/chroot_list
Login failed.

—-> touch /etc/vsftpd/chroot_list

Error 2:

[hungdiem@localhost ~]$ ftp 192.168.0.3
Connected to 192.168.0.3 (192.168.0.3).
220 Welcome to Le Vu Hung FTP service.
Name (192.168.0.3:hungdiem): hungdiem
331 Please specify the password.
Password:
500 OOPS: cannot change directory:public_html
Login failed.

—-> setsebool -P ftp_home_dir on (check SeLinux: Enforcing)





[Error Report][SSH] SSH

13 06 2008

Error 1:

saitou-mac:~ levuhung$ ssh 124.214.136.111
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
bd:45:0e:6d:cb:9a:c5:76:55:41:e4:00:a4:50:b6:06.
Please contact your system administrator.
Add correct host key in /Users/levuhung/.ssh/known_hosts to get rid of this message.
Offending key in /Users/levuhung/.ssh/known_hosts:1
RSA host key for 124.214.136.111 has changed and you have requested strict checking.
Host key verification failed.
saitou-mac:~ levuhung$

Error 2:

saitou-mac:~ levuhung$ ssh levuhung.com
Warning: the RSA host key for ‘levuhung.com’ differs from the key for the IP address ‘124.214.136.111′
Offending key for IP in /Users/levuhung/.ssh/known_hosts:1
Matching host key in /Users/levuhung/.ssh/known_hosts:2
Are you sure you want to continue connecting (yes/no)? yes
Permission denied (publickey,gssapi-with-mic).
saitou-mac:~ levuhung$

Error 3:

saitou-mac:~ levuhung$ ssh hungdiem@levuhung.com
Warning: the RSA host key for ‘levuhung.com’ differs from the key for the IP address ‘124.214.136.111′
Offending key for IP in /Users/levuhung/.ssh/known_hosts:1
Matching host key in /Users/levuhung/.ssh/known_hosts:2
Are you sure you want to continue connecting (yes/no)? yes
Permission denied (publickey,gssapi-with-mic).
saitou-mac:~ levuhung$

Error 4:

[root@levuhung ~]# yum -y install yum-fastestmirror
Loading “fastestmirror” plugin
Loading “installonlyn” plugin
Loading “downloadonly” plugin
Setting up Install Process
Setting up repositories
http://ftp.riken.jp/Linux/centos/5/os/i386/repodata/repomd.xml: [Errno 4] IOError: <urlopen error (-3, ‘\xe5\x90\x8d\xe5\x89\x8d\xe8\xa7\xa3\xe6\xb1\xba\xe6\x99\x82\xe3\x81\xae\xe4\xb8\x80\xe6\x99\x82\xe7\x9a\x84\xe3\x81\xaa\xe5\xa4\xb1\xe6\x95\x97′)>
Trying other mirror.
Error: Cannot open/read repomd.xml file for repository: base





[CentOS 5] FTP Server

7 06 2008

1. Cài đặt vsftpd

[root@centos ~]# yum -y install vsftpd

 2. Thiết lập vsftpd.conf

[root@centos ~]# vi /etc/vsftpd/vsftpd.conf

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO ← Cấm user anonymous login

# Activate logging of uploads/downloads.
xferlog_enable=YES ← Ghi nhớ vào log /var/log/vsftpd.log

# You may override where the log file goes if you like. The default is shown
# below.
xferlog_file=/var/log/vsftpd.log ← Ghi nhớ vào log /var/log/vsftpd.log

# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=NO ← Ghi nhớ vào log /var/log/vsftpd.log

# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
ascii_upload_enable=YES ← Cho phép upload
ascii_download_enable=YES ← Cho phép download

# You may fully customise the login banner string:
ftpd_banner=Welcome to blah FTP service. ← Không biểu thị tên và version phần mềm khi login FTP

# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_local_user=YES ← Cấm access vào thư mục trên mặc địnhs
chroot_list_enable=YES ← Được phép access
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list ← Danh sách user được phép access 

# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
ls_recurse_enable=YES ← Cho phép xoá thư mục

Thêm vào
local_root=public_html ← Thư mục khi login ~/public_html
use_localtime=YES ← Chỉnh thời gian

3. Khởi động vsftpd

[root@centos ~]# /etc/rc.d/init.d/vsftpd start ← Khởi động vsftpd
vsftpd 用の vsftpd を起動中:                               [  OK  ]

[root@centos ~]# chkconfig vsftpd on ← Setting khởi động tự động vsftpd

[root@centos ~]# chkconfig --list vsftpd 
vsftpd          0:off   1:off   2:on    3:on    4:on    5:on    6:off

5. Mở cổng 21 từ router