aFish
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Week4, 10/11 LSA [常見編碼特點整理](https://wallacenote.wordpress.com/2015/09/27/%E5%B8%B8%E8%A6%8B%E7%B7%A8%E7%A2%BC%E7%89%B9%E9%BB%9E%E6%95%B4%E7%90%86ascii-big5-utf-8/) ### FHS + `/boot/` 不可能在 sda (硬碟)內,會在 sda1/2/3 (分割區)內 + 沒有被分配到的目錄, 都會被分配到根目錄底下 + `/dev/loop` [wiki](https://en.wikipedia.org/wiki/Loop_device) / [中文wiki support](https://zh.wikipedia.org/wiki/Loop设备) (有人可以補充嗎? 我聼不太清楚 **有請愛心助教**) + `/home/` 使用者家目錄 + `/srv/` server 或 service 自己的服務 可放自己寫的軟體 + `/var/www/` 通常網頁會放在這裏 但是var是比較常變動的資料把網頁存放在這裏有點奇怪。 (相對於系統來說,網頁比較常變動。大多web server預設網頁路徑也在這) + `/var/run` 放那個有沒有在執行的檔案 + `/var/log` 日誌文件(各式各樣重要的紀錄檔) + `/var/log/auth.log` 認證的紀錄檔 + `/var/cache` 放應用程式的緩存文件 + `.pid` process 的 id + `.sock / .socket` 的檔案 當成 FIFO 檔 + `/opt` 通常為自己的應用程式 照理不會用到這裏 + `/lib` or `/usr/lib/` 放各式各樣 library 的地方 + `/mnt` 過去習慣臨時挂載檔案的目錄 + `/media/<username>` 新版 Ubuntu 硬體插入自動掛載目錄,例如 USB + `/proc` process的虛擬檔案 + `/tmp` 若被侵入可從這發現痕跡 + `/tmp` 另外分割並設成 noexec 可增加安全性,但可能造成部份應用安裝失敗(會將檔案暫放 /tmp 的應用) + `/var/log/auth.log` 嘗試遠端登入主機的紀錄 ### 指令 > `mount <iso file> <directory>` 掛載印象檔 > `umount <directory>` 卸載印象檔 > `ps` 看目前console執行了多少東西 > `ps aux` 查看所有行程 >> - a : 顯示所有process >> - u : 以用戶模式顯示 >> - x : 不以terminal區分 > `wc` word count > `less` 把輸出分頁顯示 可以用鍵盤上下鍵看輸出的資料 > `|` pipe,將前面 stdout 丟給後面作 stdin >> eg. `cat <filename> | less` >> `last` 一個月内,沒關機前的登入記錄 > ps aux|grep \`cat lightdm.pid\` > `/proc/<pid>$ cat stat` <pid>的狀態 > `whereis <filename/directory>` 列出某個 filename或directory的位置 > `chown <要換成的使用者>:<要換成的群組>` change owner > `netstat -an` 看目前連缐 > `last` 顯示出登錄過的使用者 > `w` 現在登入的使用者 ### Ubuntu 小知識 + 在terminal 點兩下會反白 就代表複製成功 + 按下滑鼠中間鍵就可以直接貼上 + 檔案被讀取時也會更新Access時間,Download server通常會將relatime屬性拿掉,以減輕硬碟負擔 + [sudo vuln](https://usn.ubuntu.com/3304-1/) ### 權限 - `set uid`功能 ([參考](https://www.phpini.com/linux/linux-set-setuid-setgid-permission)) ![](https://i.imgur.com/3blWr17.png) 執行該程式之後產生的process權限為擁有該程式的人之權限 (例如擁有者為B,執行者為A,該process權限為B所有) ### /var/log ssh遠端登入log file在`/var/log/auth.log`中 善用工具可以簡單分析是否有人嘗試登入你的主機 ``` sudo cat /var/log/auth.log | grep "Failed" ``` ### 功課 + 自己規劃一臺伺服器,給系上所有同學使用 + 128G SSD + 400G HDD + 功能如下 + 每個學生有自己的賬號,可以上傳自己的檔案、當成自己的空間 + 提供網頁伺服器的檔案下載 + 郵件伺服器

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully