Syok'n Lab
WEB開発のあれこれ PHP,JAVA,Javascript,Ajax,Flex,Air,Linuxなどなど 最近雑記帳になりつつある・・・
シェルの確認、変更
- 利用できるシェルの確認
$cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/ash
/bin/bsh
/bin/ksh
/usr/bin/ksh
/usr/bin/pdksh
/bin/tcsh
/bin/csh
- ログインシェルを変える (例 ここではtcshに設定
$chsh
hoge のシェルを変更します。
Password:
新しいシェル [/bin/bash]: /bin/tcsh
シェルを変更しました。
- 表示行数や桁数を変更
現在の設定を表示
$echo $LINES,$COLUMNS
24,80
行数、桁数を変更
$export LINES=30
$export COLUMNS=100
確認してみる
$echo $LINES,$COLUMNS
30,100
- シェル変数の一覧表示
$set
- 環境変数の一覧表示
$env
- コマンド履歴の表示
$history
- リソース制限の表示
$ulimit -a
- 現在、起動しているプログラムの表示
#ps ax
- システムの負荷を表示
$top
終了するにはCtrlとc を押す。
crontab
# 毎日、日付変更の 5 分後に実行する
5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
# 毎月初日の 2:15pm に実行する -- 出力は paul にメールされる
15 14 1 * * $HOME/bin/monthly
# 平日の午後 10 時に実行してジョーを心配させる
0 22 * * 1-5 mail -s "午後10時だ" joe%ジョー、%%お前の子どもはどこだい?%
23 0-23/2 * * * echo "毎日 0,2,4..時 23 分に実行する"
5 4 * * sun echo "日曜 4 時 5 分に実行する"
毎時間5分に時計をあわせる
5 * * * * ntpdate ntp.ring.gr.jp; hwclock --adjust;
vimrc
/etc/vimrc
/etc/vim/vimrc
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=utf-8,latin1
endif
set nocompatible " Use Vim defaults (much better!)
set bs=indent,eol,start " allow backspacing over everything in insert mode
"set ai " always set autoindenting on
"set backup " keep a backup file
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
" Only do this part when compiled with support for autocommands
if has("autocmd")
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
endif
if has("cscope") && filereadable("/usr/bin/cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
if &term=="xterm"
set t_Co=8
set t_Sb=[4%dm
set t_Sf=[3%dm
endif
debian ファイアウォール設定
iptables
以下rootにsuしてから行う
# iptables -P INPUT ACCEPT
# iptables -P FORWARD DROP
# iptables -P OUTPUT ACCEPT
FORWARD以外まずはACCEPT
# iptables -A INPUT -i lo -j ACCEPT
# iptables -A INPUT -p tcp --dport 80 -j ACCEPT //http
# iptables -A INPUT -p tcp --dport 443 -j ACCEPT //https
# iptables -A INPUT -p tcp --dport 21 -j ACCEPT //FTP
# iptables -A INPUT -p tcp --dport 110 -j ACCEPT //POP
# iptables -A INPUT -p tcp --dport 25 -j ACCEPT //SMTP
# iptables -A INPUT -p tcp --dport 22 -j ACCEPT //SSH
# iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# iptables -A INPUT -p tcp --dport 5901 -j ACCEPT //VNCSERVER
sambaポートの開放
# iptables -A INPUT -i eth0 -s 192.168.24.0/24 -d 192.168.24.0/24 -p udp --dport 137:138 -j ACCEPT
# iptables -A INPUT -i eth0 -s 192.168.24.0/24 -d 192.168.24.0/24 -p tcp --dport 139 -j ACCEPT
最後にINPUTポリシーをDROP
# iptables -P INPUT DROP
# vi /etc/init.d/iptables
下記内容を記述
#!/bin/bash
start(){
iptables -F
iptables-restore < /etc/iptables.save
return 0
}
stop(){
iptables-save > /etc/iptables.save
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
save)
stop
;;
restore)
start
;;
restart)
stop
start
;;
esac
その後
# chmod 755 /etc/init.d/iptables
# update-rc.d iptables defaults 18
# /etc/init.d/iptables save
これでファイアウォールの設定は完了
スポンサー
オススメ
最近のヘビロテ
![]() ![]() |
美吉田月/Ska Flavor#2 |
NIKONデジ一を購入した方。 標準レンズに物足りなさを感じたらこれを購入すると世界が広がります
![]() ![]() |
Nikon(ニコン) デジタル一眼レフカメラ用レンズ AF-S DX Nikkor 35mm F1.8G■送料全国一律840円 |
男のレシピ本。愛読させていただいてます
![]() ![]() |
男のレシピ 大胆。豪快。シンプル。女も作りたくなる男前の料理。 |
1,000円 |