icps

notes

Config

ssd

UUID

blkid -s UUID

#/etc/fstab
UUID=XX / ext4 noatime,nodiratime,discard,errors=remount-ro 0 1
tmpfs /tmp tmpfs defaults,noatime,nosuid,nodev,noexec,mode=1777,size=4G 0 0
tmpfs /var/spool tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0

tab補完

if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

Repos

#/etc/apt/sources.list
#Kali
deb http://ftp.tku.edu.tw/kali kali main contrib non-free
deb http://ftp.tku.edu.tw/kali-security kali main contrib non-free
#Ubuntu Main Repos
deb http://free.nchc.org.tw/ubuntu/ trusty main restricted universe multiverse
#Ubuntu Update Repos
deb http://free.nchc.org.tw/ubuntu/ trusty-security main restricted universe multiverse
deb http://free.nchc.org.tw/ubuntu/ trusty-updates main restricted universe multiverse

sudo no passwd

visudo
%sudo   ALL=(ALL:ALL) NOPASSWD:ALL

vbox sharefile

mount -t vboxsf REKCAH /data/REKCAH

informatrion

linux版本 : lsb_release -a
cpu : cat /proc/cpuinfo
mem : cat /proc/meminfo
記憶體使用狀況 : free -m
硬體資訊 : dmidecode
顯示卡型號 : lspci | grep VGA
硬碟資訊 : smartctl -a /dev/sda
USB : lsusb
kernel版本 : uname -a
dmesg : kernel logs

TimeZone

cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime

#

find $PWD/test | xargs ls -d1

關閉傳送內部錯誤

/etc/default/apport enbable=0

apt-get install gcc make libsqlite3-dev nodejs zlib1g-dev

顏色

force_color_prompt=yes

移除舊核心

apt-get remove $(dpkg -l|egrep '^ii linux-(im|he)'|awk '{print $2}'|grep -v `uname -r`)

ip forward

#/etc/sysctl.conf net.ipv4.ip_forward=1

save iptables

apt install iptables-persistent

crontab

sudo nano /etc/rsyslog.d/50-default.conf cron.* /var/log/cron.log 去掉#

/etc/init.d/rsyslog restart /etc/init.d/cron restart

nat

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
wlan=
lan= sudo iptables -t nat -A POSTROUTING -o $wlan -j MASQUERADE
sudo iptables -A FORWARD -i $wlan -o $lan -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i $lan -o $wlan -j ACCEPT

network

1
2
3
4
5
6
7
8
#/etc/udev/rules.d/
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:00:00:00:00", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

#/etc/network/interfaces
allow-hotplug eth0
iface eth0 inet static
  address 192.168.0.1
  network 255.255.255.0

ssh

Could not load host key: /etc/ssh/ssh_host_rsa_key

ls -al /etc/ssh/ssh*key
sudo dpkg-reconfigure openssh-server