Linux Server 經常使用配置

Linux Setting

 

History with timestamp

vim ~/.bashrcvim

//add the below line to .bashrc file and then save it,bash

export HISTTIMEFORMAT="%y/%m/%d %T "app

//run the below command to source .bashrc file,ssh

source ~/.bashrctcp

scp trust connection

若是兩臺機器  host_src and host_desc用scp 傳輸文件的時候,會須要密碼spa

        on host_src scp path/file name@host_desc:/pathorm

若是是crontab的話,須要 trust connection. crontab

on host_src ssh-keygen -t rsaip

·      cd ~/.ssh ci

·      ls  

o   id_rsa and id_rsa.pub

o   id_rsa is private key

o   id_rsa.pub is the public key

on host_desc

·      edit  .ssh/authorized_keys

o   setup new one if not exists    

  • append id_ras.pub to the      end.

注意

1.   ssh-keygen -t rsa 會覆蓋之前的private key

2.   注意 authorized_keys 的 file premission.

 

Vimdiff fileA fileB

 

Diff fileA and fileB

 

IPTables

 

iptables -A INPUT -s clientip  -j REJECT  //reject connect from client

 

iptables -A OUTPUT -d clientip  -j DROP   //accept connection 

 

//let the tcp handshake happens, then kill the connection

iptables -A OUTPUT -d clientip -p tcp --tcp-flags SYN,ACK SYN,ACK -j ACCEPT

iptables -A OUTPUT -d clientip  -j DROP

 

//back to normail

iptables --flush INPUT

iptables --flush OUTPUT

相關文章
相關標籤/搜索