2014年12月11日 星期四

How To Protect SSH/FTP using Fail2ban on CentOS/RHEL

http://tecadmin.net/protect-ssh-ftp-using-fail2ban-on-centos-rhel/


相關參數
http://manpages.ubuntu.com/manpages/saucy/man1/fail2ban-client.1.html

vsftp 安裝及設定

安裝
yum install vsftpd

設定
vi /etc/vsftpd/vsftpd.conf

local_enable=YES
write_enable=YES
userlist_enable=YES
userlist_deny=YES
use_localtime=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
pam_service_name=vsftpd
tcp_wrappers=YES

# 關閉匿名登入
anonymous_enable=NO

# 改變 umask 讓新增的檔案屬性為 750 (umask 計算方式為:777 - 027 = 750)
local_umask=027

# 設定 idle 斷線時間(秒)
idle_session_timeout=600

# 設定 timeout 時間(秒)
data_connection_timeout=120

# 設定 chroot 避免使用者亂跑
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list

# 限制最高幾個 client 連線
max_clients=20

# 限制同一個 ip 可以建立多少連線
max_per_ip=5




Linux 掛載(Mount) NTFS (Windows磁區)

DOWNLOAD
http://www.tuxera.com/community/ntfs-3g-download/

tar -xzvf [target]

./configure

make

make install

NOTE:
如果conpiler失敗需確認gcc是否安裝
yum install gcc

掛載
mount -t ntfs-3g /dev/sda1 /mnt/windows

開機自動掛載
vi /etc/fstab
加入
/dev/sda1 /mnt/windows ntfs-3g defaults 0 0

2014年11月24日 星期一

A Command Line Web Browsing with Lynx and Links Tools

http://www.tecmint.com/command-line-web-browsers/

Installation of Lynx and Links

Install Lynx on Debian based Linux systems.
# apt-get install lynx
# apt-get install links
Install Lynx on Red Hat based Linux systems.
# yum -y install lynx
# yum -y install links

How to Use Lynx and Links

Open a link: lynx/links http://www.tecmint.com.
# lynx http://www.tecmint.com
OR
# links http://www.tecmint.com

SSH連現時出現「WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!」解決辦法

ssh-keygen -R 伺服器端的IP

2014年10月25日 星期六

[MAC]顯示詳細路徑

(1) 開啓 Finder 顯示完整路徑的設定
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

(2) 關閉所有 Finder
killall Finder

2014年8月19日 星期二

OS X 10.10 Yosemite 重置 Launchpad 的方法

defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock

學習CSS版面配置

http://zh-tw.learnlayout.com/

mysqldump 只導出數據或欄位

備份資料庫
#mysqldump 数据库名 >数据库备份名  
  
#mysqldump -A -u用户名 -p密码 数据库名>数据库备份名  
  
#mysqldump -d -A --add-drop-table -uroot -p >xxx.sql  


2014年8月18日 星期一

Mac OS X 自帶apache啟動php

/etc/apache2/httpd.conf文件,把#loadModule php5_module libexec/apache2/libphp5.so 前面的#去掉
cp /etc/php.ini.default /etc/php.ini

服務重啟:apachectl start
WEB根目錄:/Libary/WebServer/Documents/