---
robots: index, follow
tags: NCTU, CS, 共筆
description: 交大資工課程學習筆記
lang: zh-tw
dir: ltr
breaks: true
disqus: calee
GA: UA-100433652-1
---
# 系統管理實務--易志偉
- 大家在做作業時,也可以紀錄作業一下自己的步驟
- 前面的 bonus 最好盡力做滿
# **友站**
- [2015-SA](https://hackpad.com/-2015-56AUapur5Yc)
- [2014-SA](https://hackpad.com/2014-SA-OSVYgtAZXfD)
# COURSE 1
# COURSE 2
- CISSP (Physical and Environmental Security): 管理者指標
- Shell works: Fetch command -> Analyze -> Execute
- used RC: logout/login, source, . .tcshrc
- PS1: shell rc 的樣式, PS2: 下一行的樣式
- $val or ${val}
- *, ?, [...] -> 要有中間的, [!...] -> 不要有中間的
- # 註解, && 前面成功再做後面, || 前面沒成功再做後面的, & 背景執行
- Dirs, popd , pushd
阿這好難排好看啊QQ還是要來試用 HackMD O_____O
# **COURSE 5**
- File System
- ls -l: drwx--x--x link owner group size time name
- Architecture: pathname, file tree, mounting, file types
- Application <-> Kernel <-> Hardware
- main components
- namespace
- api
- security model
- implementation
- object
- files and dir
- hardware device ( /dev/... )
- process info
- IPC (Interprocess communication channel) 網路的東西
- SHM (shared memory segments)
- man hier
- /bin /sbin /usr/bin /usr/sbin
- /usr
- /lib /libexec /usr/include
- /mnt
- /usr/src
- /etc /usr/local/etc
- /var
- /dev
- mount disk
- disk partition
- network file servers
- mount point
- fstab
# **HW 1**
看看投影片就好了
other group 記得加 wheel (或寫 0) ←寫0好像沒效(Re:對啊)
sudo install:
Visual to edit sudoer's power
# **HW 2**
善用 [sed & awk](https://goo.gl/kiqiY3) && [正規表示法](https://regexcrossword.com/) <- 正規練習網站
**Filesystem Statistic**
會用到的指令 ls grep cut sort awk
awk用法 ~~會寫C就會寫awk~~
BEGIN {} 在讀檔前執行{}內的code
/regex/{} 檔案裡符合regex的那行才會執行{}內的code
END {} 整個檔案讀完才執行{}內的code
~~題目限制不能用分號~~,要把expression用{}包起來,效果跟; 一樣
更正:awk裡面還是可以用分號,問過助教了
應該不會超過300字元
**Mango Browser**
dialog --inputbox, --msgbox, --yesno --menu
跑https網頁: sudo pkg install ca_root_nss
在放shell script的變數時, 第一次放的等號兩旁不能有空格@@ (e.g. variable=10, 不能 variable = 10)
比較保險的方式:變數都用 " " 包起來 (e.g. "$(lalala)")
檢查url: 可以用 [正規](http://mropengate.blogspot.tw/2015/02/regular-expression.html) 也可以試著直接用 [ping](http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html) 的 (ping 只能ping domin, ex: [http://nasa.cs.nctu.edu.tw/sap](http://nasa.cs.nctu.edu.tw/sap) 中, http:// 跟 /sap 都要拔掉)
有些載點有空白([http://nasa.cs.nctu.edu.tw/nap/2015](http://nasa.cs.nctu.edu.tw/nap/2015)) 可以把空白鍵置換成%20
# **HW3**
**Micro Computer Center**
FreeBSD Handbook NFS : [https://www.freebsd.org/doc/handbook/network-nfs.html](https://www.freebsd.org/doc/handbook/network-nfs.html)
For NFS Server
Create NFS Server from zpool
$ zfs set sharenfs="-alldirs -maproot=nobody sabsd saduty" vol/home
$ zfs set sharenfs="-ro sabsd saduty" vol/data
$ zfs set sharenfs="-ro sabsd saduty" vol/admin
Ref : [](https://docs.oracle.com/cd/E26502_01/html/E29007/gayne.html)[https://docs.oracle.com/cd/E26502_01/html/E29007/gayne.html](https://docs.oracle.com/cd/E26502_01/html/E29007/gayne.html)
For NFS Client
autofs
NFS Server 斷線之後會重新掛載
/etc/rc.conf
autofs_enable="YES"
/etc/auto_master
#/net -hosts -nobrowse,nosuid,intr
/net /etc/auto_net
/etc/auto_net
home -rw,soft sahome:/vol/home
data -ro,soft sahome:/vol/data
admin -ro,soft sahome:/vol/admin