{
 "檔案分享概念與 Samba 伺服器#1": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   2,
   2
  ],
  "cards": [
   {
    "title": "SMB / Samba",
    "points": [
     "Windows 原生協定",
     "Windows、Mac、Linux 都能用"
    ]
   },
   {
    "title": "NFS",
    "points": [
     "Unix / Linux 網路檔案系統",
     "適合 Linux 伺服器之間"
    ]
   }
  ]
 },
 "檔案分享概念與 Samba 伺服器#2": {
  "type": "table",
  "head": [
   "項目",
   "用途"
  ],
  "rows": [
   [
    "smbd",
    "檔案與列印分享"
   ],
   [
    "nmbd",
    "NetBIOS 名稱服務"
   ],
   [
    "smb.conf",
    "Samba 設定檔"
   ]
  ],
  "reveal": [
   0,
   3,
   3,
   3
  ],
  "widths": [
   1,
   2
  ]
 },
 "檔案分享概念與 Samba 伺服器#3": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3
  ],
  "cards": [
   {
    "title": "team 群組",
    "points": [
     "/srv/samba/team"
    ]
   },
   {
    "title": "2",
    "points": [
     "setgid",
     "新檔繼承 team 群組"
    ]
   },
   {
    "title": "770",
    "points": [
     "擁有者、群組可讀寫執行",
     "其他人無權限"
    ]
   }
  ]
 },
 "檔案分享概念與 Samba 伺服器#4": {
  "type": "flow",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "nodes": [
   {
    "label": "建立群組",
    "sub": "groupadd team"
   },
   {
    "label": "建立目錄",
    "sub": "mkdir -p"
   },
   {
    "label": "設定擁有者",
    "sub": "chown root:team"
   },
   {
    "label": "設定權限",
    "sub": "chmod 2770",
    "kind": "end"
   }
  ]
 },
 "檔案分享概念與 Samba 伺服器#5": {
  "type": "table",
  "head": [
   "設定",
   "意義"
  ],
  "rows": [
   [
    "[team]",
    "分享名稱"
   ],
   [
    "valid users = @team",
    "只有 team 群組可存取"
   ],
   [
    "create mask / directory mask",
    "新檔與目錄權限上限"
   ]
  ],
  "reveal": [
   0,
   1,
   2,
   3,
   3
  ],
  "widths": [
   3,
   3
  ]
 },
 "檔案分享概念與 Samba 伺服器#6": {
  "type": "flow",
  "reveal": [
   1,
   3,
   3,
   4
  ],
  "nodes": [
   {
    "label": "編輯設定",
    "sub": "smb.conf"
   },
   {
    "label": "檢查語法",
    "sub": "testparm"
   },
   {
    "label": "Loaded services file OK"
   },
   {
    "label": "重新啟動",
    "sub": "restart smbd",
    "kind": "end"
   }
  ],
  "layout": "row"
 },
 "檔案分享概念與 Samba 伺服器#7": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3
  ],
  "cards": [
   {
    "title": "只寫 smb.conf",
    "points": [
     "Samba 有自己的密碼資料庫"
    ]
   },
   {
    "title": "兩層關卡",
    "points": [
     "Linux 目錄權限",
     "smb.conf 設定",
     "都放行才能存取"
    ]
   },
   {
    "title": "SELinux",
    "points": [
     "Red Hat 系列",
     "需另設標籤與布林值"
    ]
   }
  ]
 },
 "Samba 使用者、防火牆與客戶端連線#1": {
  "type": "flow",
  "reveal": [
   1,
   1,
   2,
   3
  ],
  "nodes": [
   {
    "label": "系統帳號",
    "sub": "adduser"
   },
   {
    "label": "Samba 密碼",
    "sub": "smbpasswd -a"
   },
   {
    "label": "列出使用者",
    "sub": "pdbedit -L",
    "kind": "end"
   }
  ]
 },
 "Samba 使用者、防火牆與客戶端連線#2": {
  "type": "flow",
  "reveal": [
   0,
   1,
   2,
   3,
   3,
   3
  ],
  "nodes": [
   {
    "label": "建立 alice",
    "sub": "adduser"
   },
   {
    "label": "加入 team",
    "sub": "usermod -aG"
   },
   {
    "label": "Samba 密碼",
    "sub": "smbpasswd -a",
    "kind": "end"
   }
  ]
 },
 "Samba 使用者、防火牆與客戶端連線#4": {
  "type": "bar",
  "labels": [
   "SMB 埠",
   "歷史埠"
  ],
  "values": [
   445,
   139
  ],
  "unit": "",
  "reveal": [
   0,
   2,
   2,
   2
  ],
  "highlight": 0
 },
 "Samba 使用者、防火牆與客戶端連線#5": {
  "type": "table",
  "head": [
   "系統",
   "指令"
  ],
  "rows": [
   [
    "Ubuntu",
    "sudo ufw allow from 192.168.1.0/24 to any app Samba"
   ],
   [
    "RHEL",
    "sudo firewall-cmd --permanent --add-service=samba"
   ],
   [
    "RHEL",
    "sudo firewall-cmd --reload"
   ]
  ],
  "reveal": [
   0,
   1,
   2,
   3
  ],
  "widths": [
   1,
   5
  ]
 },
 "Samba 使用者、防火牆與客戶端連線#6": {
  "type": "flow",
  "reveal": [
   0,
   1,
   3,
   4,
   5,
   6
  ],
  "nodes": [
   {
    "label": "安裝工具",
    "sub": "smbclient"
   },
   {
    "label": "建掛載點",
    "sub": "mkdir -p"
   },
   {
    "label": "掛載",
    "sub": "mount -t cifs"
   },
   {
    "label": "輸入密碼"
   },
   {
    "label": "憑證檔",
    "sub": "權限 600"
   },
   {
    "label": "寫入 fstab",
    "sub": "credentials=",
    "kind": "end"
   }
  ]
 },
 "Samba 使用者、防火牆與客戶端連線#7": {
  "type": "flow",
  "reveal": [
   1,
   3
  ],
  "nodes": [
   {
    "label": "備份 fstab"
   },
   {
    "label": "修改 fstab"
   },
   {
    "label": "測試",
    "sub": "mount -a",
    "kind": "end"
   }
  ]
 },
 "NFS 匯出與掛載#1": {
  "type": "table",
  "head": [
   "選項",
   "意義"
  ],
  "rows": [
   [
    "rw / ro",
    "讀寫 / 唯讀"
   ],
   [
    "sync",
    "寫入磁碟後才回應"
   ],
   [
    "no_subtree_check",
    "建議設定"
   ],
   [
    "root_squash",
    "root 對映為 nobody"
   ]
  ],
  "reveal": [
   0,
   0,
   0,
   1,
   2,
   3,
   4
  ],
  "widths": [
   2,
   3
  ]
 },
 "NFS 匯出與掛載#2": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2
  ],
  "cards": [
   {
    "title": "no_root_squash",
    "points": [
     "用戶端 root 在目錄裡也是 root",
     "非常危險"
    ]
   },
   {
    "title": "匯出來源",
    "points": [
     "限制特定 IP 或網段",
     "不要寫星號"
    ]
   }
  ]
 },
 "NFS 匯出與掛載#3": {
  "type": "flow",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "nodes": [
   {
    "label": "安裝",
    "sub": "nfs-kernel-server"
   },
   {
    "label": "建立目錄",
    "sub": "mkdir -p"
   },
   {
    "label": "設定擁有者",
    "sub": "nobody:nogroup"
   },
   {
    "label": "設定權限",
    "sub": "chmod 755",
    "kind": "end"
   }
  ]
 },
 "NFS 匯出與掛載#4": {
  "type": "flow",
  "reveal": [
   1,
   3,
   4,
   5
  ],
  "nodes": [
   {
    "label": "目錄"
   },
   {
    "label": "允許主機"
   },
   {
    "label": "(選項)"
   },
   {
    "label": "套用",
    "sub": "exportfs -ra"
   },
   {
    "label": "檢查",
    "sub": "exportfs -v",
    "kind": "end"
   }
  ]
 },
 "NFS 匯出與掛載#6": {
  "type": "table",
  "head": [
   "系統",
   "做法"
  ],
  "rows": [
   [
    "Ubuntu",
    "ufw 只允許內網網段連到 2049"
   ],
   [
    "RHEL",
    "firewall-cmd 新增 nfs 服務,再 reload"
   ]
  ],
  "reveal": [
   0,
   2
  ],
  "widths": [
   1,
   3
  ]
 },
 "NFS 匯出與掛載#7": {
  "type": "flow",
  "reveal": [
   4,
   4,
   6,
   6
  ],
  "nodes": [
   {
    "label": "安裝",
    "sub": "nfs-common"
   },
   {
    "label": "查詢",
    "sub": "showmount -e"
   },
   {
    "label": "建掛載點"
   },
   {
    "label": "掛載",
    "sub": "mount -t nfs"
   },
   {
    "label": "寫入 fstab"
   },
   {
    "label": "驗證",
    "sub": "mount -a",
    "kind": "end"
   }
  ]
 }
}