Showing posts with label Linux share. Show all posts
Showing posts with label Linux share. Show all posts
Wednesday, April 17, 2013
Ubuntu , Debian Vim with text highlight
1. cp /etc/vim/vimrc ~/.vimrc
1. vi ~/.vimrc
remove ” before syntax on
Better For Shell Script: textmate.vim
VIM color scheme:
http://blog.lyhdev.com/2013/01/ubuntu-vim.html
Add below if using pure vim:
set t_Co=256
http://chimerhapsody.blogspot.tw/2012/12/vim-color-scheme.html
Friday, February 01, 2013
Linux Network Traffic Statistics - IPTRAF
Ref. http://i-yow.blogspot.tw/2008/10/iptraf.html
1.安裝IPTraf
2.安裝IPTraf
iptraf
執行後出現主畫面
可依想看的資訊分類,可分網卡、分協定、分封包大小.....等,還可自訂規則過濾。
1.安裝IPTraf
yum install iptraf
2.安裝IPTraf
iptraf
執行後出現主畫面
可依想看的資訊分類,可分網卡、分協定、分封包大小.....等,還可自訂規則過濾。
Sunday, January 13, 2013
Proxy Authentication - Squid
※ Ref. http://blog.faq-book.com/?p=5334
Ref. http://www.babyface2.com/NetAdmin/27200804squid/
Ref. http://www.babyface2.com/NetAdmin/27200804squid/
1
2
3
4
5
6
7
|
[root@localhost ~]# rpm -ql squid | grep ncsa
/usr/lib64/squid/ncsa_auth
/usr/share/man/man8/ncsa_auth.8.gz
[root@localhost ~]# rpm -ql httpd | grep htpasswd
/usr/bin/htpasswd
/usr/share/man/man1/htpasswd.1.gz
|
1
|
[root@localhost ~]# yum install httpd squid
|
1
2
3
4
5
6
7
|
[root@localhost ~]# vim /etc/squid/squid.conf
#修改前
#acl password proxy_auth REQUIRED
#修改後
acl password proxy_auth REQUIRED
http_access allow password
|
auth_param basic children 5
同時接受認證的連線數
auth_param basic realm Squid proxy-caching web server
使用者在輸入帳密的地方所顯示的說明文字
auth_param basic credentialsttl 2 hours
使用者連線時的連續時間
auth_param basic casesensitive off
使用特殊權限的帳號登入時會直接取消不給登入
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
[root@localhost ~]# vim /etc/squid/squid.conf
#修改前
#auth_param basic program /usr/libexec/ncsa_auth /usr/etc/passwd
#auth_param basic children 5
#auth_param basic realm Squid proxy-caching web server
#auth_param basic credentialsttl 2 hours
#auth_param basic casesensitive off
#修改後
auth_param basic program /usr/lib64/squid/ncsa_auth /usr/etc/passwd
auth_param basic children 5
auth_param basic realm welcome FAQ Squid test service
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
|
1.4 建立帳密
在使用htpasswd建立帳密時第一次要記得加參數-c,之後就不用加了。「derek」和「faq」為要新增的帳號。
1
2
3
4
5
6
7
8
9
|
[root@localhost ~]# htpasswd -c /usr/etc/passwd derek
New password:
Re-type new password:
Adding password for user derek
[root@localhost ~]# htpasswd /usr/etc/passwd faq
New password:
Re-type new password:
Adding password for user faq
|
Linux Timezone
The following information has been given:
Taiwan
Therefore TZ='Asia/Taipei' will be used.
Local time is now: Mon Jan 14 08:13:48 CST 2013.
Universal Time is now: Mon Jan 14 00:13:48 UTC 2013.
Is the above information OK?
1) Yes
2) No
#? 1
You can make this change permanent for yourself by appending the line
TZ='Asia/Taipei'; export TZ
to the file '.profile' in your home directory; then log out and log in again.
Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Taipei
1. [root@li420-243 ~]# vim /etc/sysconfig/clock
ZONE="Asia/Taipei"
#ZONE="Etc/UTC"
3. [root@li420-243 ~]# tzdata-update
[root@li420-243 ~]# date
Mon Jan 14 08:16:27 CST 2013
Tuesday, November 20, 2012
Linux change atime,mtime using touch
Ref. http://www.csie.cyut.edu.tw/~dywang/linuxSystem/node37.html
- 檔案變動時間
- atime (Access time):檔案內容上次被讀取的時間;
- ctime (Change status time):檔案狀態最近被更動的時間(不論是屬性、權限等);
- mtime (Modification time):檔案內容最近被修改的時間。
- 查詢檔案 /etc/man.conf 變動時間
[root@dywHome2 ~]# ll /etc/man.config <==預設為 mtime -rw-r--r-- 1 root root 4831 Feb 3 2008 /etc/man.config [root@dywHome2 ~]# ll --time=atime /etc/man.config -rw-r--r-- 1 root root 4831 Sep 5 09:30 /etc/man.config [root@dywHome2 ~]# ll --time=ctime /etc/man.config -rw-r--r-- 1 root root 4831 Feb 3 2008 /etc/man.config [root@dywHome2 ~]# ll --time=mtime /etc/man.config
- touch:修改檔案時間,若檔案不存在,則產生新檔案。
[root@linux ~]# touch [-acdmt] 檔案 參數: -a :僅修訂 access time; -c :僅修改時間,而不建立檔案; -d :後面可以接日期,也可以使用 --date="日期或時間" -m :僅修改 mtime ; -t :後面可以接時間,格式為[YYMMDDhhmm] 範例: 範例一:新建一個空的檔案 [root@linux ~]# cd /tmp [root@linux tmp]# touch testtouch [root@linux tmp]# ls -l testtouch -rw-r--r-- 1 root root 0 Jul 19 20:49 testtouch 範例二:將 ~/.bashrc 複製成為 bashrc,假設複製完全的屬性,檢查其日期 [root@linux tmp]# cp ~/.bashrc bashrc [root@linux tmp]# ll bashrc; ll --time=atime bashrc; ll --time=ctime bashrc -rwxr-xr-x 1 root root 395 Jul 4 11:45 bashrc <==這是 mtime -rwxr-xr-x 1 root root 395 Jul 19 20:44 bashrc <==這是 atime -rwxr-xr-x 1 root root 395 Jul 19 20:53 bashrc <==這是 ctime 範例三:修改案例二的 bashrc 檔案,將日期調整為兩天前 [root@linux tmp]# touch -d "2 days ago" bashrc [root@linux tmp]# ll bashrc; ll --time=atime bashrc; ll --time=ctime bashrc -rwxr-xr-x 1 root root 395 Jul 17 21:02 bashrc -rwxr-xr-x 1 root root 395 Jul 17 21:02 bashrc -rwxr-xr-x 1 root root 395 Jul 19 21:02 bashrc # 日期在 atime 與 mtime 都改變了,但是 ctime 則是記錄目前的時間! 範例四:將上個範例的 bashrc 日期改為 2005/07/15 2:02 [root@linux tmp]# touch -t 0507150202 bashrc [root@linux tmp]# ll bashrc; ll --time=atime bashrc; ll --time=ctime bashrc -rwxr-xr-x 1 root root 395 Jul 15 02:02 bashrc -rwxr-xr-x 1 root root 395 Jul 15 02:02 bashrc -rwxr-xr-x 1 root root 395 Jul 19 21:05 bashrc
Monday, October 29, 2012
Delete Files Older than 5 days
Ref. http://www.howtogeek.com/howto/ubuntu/delete-files-older-than-x-days-on-linux/
find /path/to/files* -mtime +5 -exec rm {} \;
find /path/to/files* -mtime +5 -exec rm {} \;
Tuesday, October 16, 2012
Linux Package Management - RPM, DPKG
===============================================
dpkg
===============================================
Install Package ---->
-i(--install)
Remove Package---->
-r(--remove):remove totally exluding config file
-p(--purge) :remove totally
including config file
Query Package ---->
-l(--list) :list all package
-L package:print info
about package(file location…)
-S file:Search which
package is the file belong to (such as rpm –qf)
===============================================
apt-get
===============================================
apt-get
-d:Only download the
package file
-y:force to answer yes
install
package:install
remove package:remove
update:list
available package
===============================================
rpm
===============================================
rpm db location: /var/lib/rpm
rpm
--rebuilddb
---------------------------------------------------------------------------
Package Verify
---------------------------------------------------------------------------
-V
Package : Verify the changed file belonged to the package and list them.
-Va : List all the changed file belonged
to all packages.
-Vp Package : List possibly changed file
belonged to the package.
-Vf
file : Verify if the file is been changed.
-K Package : check the Package’s MD5 checksum and pgp.
--checksig:check Package’s
MD5 checksum and pgp.
S :file Size differs
M :Mode differs
(includes permissions and file type)
5 :MD5 sum differs
D :Device major/minor
number mis-match
L :readLink(2) path
mis-match
U :User ownership
differs
G :Group ownership
differs
T :mTime differs
import keys : rpm --import
/usr/share/rhn/RPM-GPG-KEY
/usr/share/doc/rpm-4.4.2/RPM-GPG-KEY
/usr/share/doc/fedora-release-5/RPM-GPG-KEY
/etc/pki/rpm-gpg/RPM-GPG-KEY
---------------------------------------------------------------------------
rpm -ivh Package
---------------------------------------------------------------------------
-i :install
-v :show the process
-h :show the process in
percent.
--nodeps :
--nomd5 :
--noscripts :
--replacefiles :
--replacepkgs :
--force :
--test :
---------------------------------------------------------------------------
Upgrade and Update
---------------------------------------------------------------------------
-Uvh : Install and update.
-Fvh : Upgrade only if the older package
is installed
---------------------------------------------------------------------------
Remove Package
---------------------------------------------------------------------------
rpm –e Package
rpm –e Package
--allmaches : Remove all versions of the
package which match PACKAGE_NAME.
rpm –e Package
--nodeps : Don't check dependencies before
uninstalling the packages.
---------------------------------------------------------------------------
Query
---------------------------------------------------------------------------
rpm
-q Package : check if the package
exists.
rpm
-ql Package : List all the files belonged to the package.
rpm
-qi Package : Print info about the package.
rpm
-qf file : Search which package is the file belong to.
rpm
-qc Package : List the config file of the package.
rpm
-qd Package : List the document about the package location.
rpm
-qR Package : List the dependency of the package(prequesite).
rpm
-qa :List all the installed package.
Subscribe to:
Comments (Atom)


