張維哲
    • 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
    • Make a copy
    • 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 Make a copy 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
    # SA 期中考古 # 2018(朱蝶給的) ![](https://i.imgur.com/03zZbO4.jpg) 第一大題第九題應該是D ![](https://i.imgur.com/VORqWFF.jpg) ![](https://i.imgur.com/iKh1zMs.jpg) ![](https://i.imgur.com/aISMZub.jpg) # 2017 ## 第1題 ### A 可利用regular expression來以關鍵字搜尋 ### B 指令後數字所代表的意義 1:可執行的程式或是 shell 指令。 2:系統呼叫(system calls,Linux 核心所提供的函數)。 3:一般函式庫函數。 4:特殊檔案(通常位於 /dev)。 5:檔案格式與協定,如 /etc/passwd 6:遊戲。 7:雜項(巨集等,如 man(7)、groff(7))。 8:系統管理者指令(通常是管理者 root 專用的)。 9:Kernel routines(非標準)。 ### C man 5 crontab ## 第2題 ### A 只是無法登入shell,還是可用其他的資源系統 ### B lock user:passwd -l username unlock user:passwd -u username ## 第3題 ### A `格式: 帳號名稱 來源主機=(可切換帳號) 可執行的指令` Wangth這個使用者可以從任何地方登入,不能切換到其他帳號,可以以無密碼的方式執行/sbin/reboot ### B su 只是取得root權限,環境變數並沒有改變 su- 取得root權限,環境變數會跟著改變 ## 第4題 ### A i.kill -9 PID (non-catchable, non-ignorable kill) ii.renice [number] PID iii. kill -15 PID (software termination signal) ### B 2->3->1 選擇2時至少程式還會繼續執行,1和3都不會繼續執行,3較1好的原因是程式可能當下在執行不可被中斷的部分,而software termination signal可以暫時被catch。 ## 第5題 ### A > UID=1002, GID=1000, EUID=0, EGID=1000 > 不確定 > [name=Eugene@20191106-15:15] ### B > UID=1002, GID=1000, EUID=1002, EGID=1199 > 不確定 > [name=Eugene@20191106-15:15] ### C > 不能執行 > [name=Eugene@20191106-15:15] ### D 代表有使用setuid。 In the event that a vulnerable process uses the setuid bit to run as root, the code will execute with root privileges, in effect giving the attacker root access to the system on which the vulnerable process is running. ## 第6題 ### A r-- ### B 若一個目錄有設置sticky bit,只有擁有者(還有root)能夠刪除此目錄底下的檔案,其他人不可刪除。 ## 第7題 ### A 相對路徑是相對於現在目錄的路徑表示,也就是你現在這個檔案在哪裡,這個目錄的路徑起始點就在哪裡,所以每個檔案的相對路徑起始點都可能會不同。 絕對路徑是一個絕對位置,他不會隨著檔案位置的變換而改變他的路徑。 ### B 執行ls時系統會去 $PATH 中的路徑去尋找可以執行ls的程式,而執行家目錄的程式需要指定路徑的原因就是因為 $PATH 中沒有包含家目錄的路徑 ## 第8題 ### A 是作業系統的檔案系統虛擬層,在其下是實體的檔案系統。虛擬檔案系統的主要功用,在於讓上層的軟體,能夠用單一的方式,來跟底層不同的檔案系統溝通。(By wiki) ### B hard link-associate two or more filenames with the same inode,but hard link must in the same partition and only can use in directory symbolic link-他就是在建立一個獨立的檔案,而這個檔案會讓資料的讀取指向他 link 的那個檔案內容!由於只是利用檔案來做為指向的動作,所以,當來源檔被刪除之後,symbolic link 的檔案會『開不了』 ## 第9題 > 目錄用 777 > 檔案用 666 > [name=Eugene@20191106-15:18] ### A umask=777-007=770 ### B umask=666-640=026 ## 第10題 ### A 5 * * * * user /root/check_CPU.sh ### B 3-59/10 * * * * user /root/check_CPU.sh ### C 0 8-17 * * 1,5 user /root/check_CPU.sh ### D export EDITOR=/path/to/specific/editor ## 第11題 ### A 有些程式可能不在port collection或是package database中 其他:tar ball ### B port會有dependency check;tar ball沒有 ## 第12題 ### A rcorder ### B ![](https://i.imgur.com/yQlI3Ew.png) Each file passed to rcorder must be annotated with special lines (which look like comments to the shell) which indicate the dependencies the files have upon certain points in the sequence, known as "conditions", and which indicate, for each file, which "conditions" may be expected to be filled by that file. Within each file, a block containing a series of "REQUIRE", "PROVIDE", "BEFORE" and "KEYWORD" lines must appear. The format of the lines is rigid. Each line must begin with a single'#', followed by a single space, followed by "PROVIDE:", "REQUIRE:", "BEFORE:", or "KEYWORD:". No deviation is permitted. Each dependency line is then followed by a se- ries of conditions, separated by whitespace. Multiple "PROVIDE", "REQUIRE", "BEFORE" and "KEYWORD" lines may appear, but all such lines must appear in a sequence without any intervening lines, as once a line that does not follow the format is reached, parsing stops. ## 第13題 ### A 每日、每週、每月透過 cron(8),執行的定期排程 Script > 執行順序如何決定? Execution order depends on filenames, use number as prefix to control the order > [name=Eugene@20191106-14:35] ### B ??? ## 第14題 ### A 在/var/at/at.allow檔案裡,輸入可以使用at的使用者 ### B 不行,at只能在特定的時間觸發一次 ## 第15題 此檔案可用來設定 DNS 用戶端要求名稱解析時,所定義的各項內容。我們分別來看一個完整的resolv.conf的檔案: domain twnic.com.tw nameserver 192.168.10.1 nameserver 192.168.2.5 search twnic.com.tw twnic.net.tw “domain”指定本地的網域名稱,如果查詢時的名稱沒有包含小數點,則會自動補上此處的網域名稱為字尾再送給DNS伺服器。 “nameserver”指定用戶端要求進行名稱解析的 nameserver IP位址,在此可指定多部DNS伺服器,則用戶端將會依序提出查詢要求。 “search”這個選項為非必要選項,而功能在於若使用者指定主機名稱查詢時,所需要搜尋的網域名稱。例如,當我們設 “search twnic.com.tw”時,當DNS伺服器在做名稱解析過程中,無法對輸入的名稱,例如pc1,找出相對應的IP時,則DNS會利用search的設定值加上需查詢的名稱,即pc1.twnic.com.tw來進行解析,解析失敗時則會嘗試pc1.twnic.net.tw。 需要注意的是當我們想嘗試多種在沒有包含小數點,於字尾補上所需要搜尋的網域名稱時,我們會在"search"中指定幾種組合給DNS伺服器,而不能在"domain"中指定。因為“domain”是指定本地的網域名稱,而搜尋時也以“domain”為優先嘗試,如果失敗之後才會嘗試"search"中的組合。 当访问的域名不能被DNS解析时,resolver会将该域名加上search指定的参数,重新请求DNS,直到被正确解析或试完search指定的列表为止 ## 第16題 ### A shutdown -r time ->The system is rebooted at the specified time. shutdown -h time->The system is halted at the specified time. shutdown -p time->The system is halted and the power is turned off (hardware support required, otherwise the system is halted) at the specified time. ### B shutdown -p yymmddhhmm shutdown -p +number(單位:分鐘) shutdown -p now ## 第17題 ### A enable logging to a remote loghost named loghost ### B > |level| > |-| > |emerg| > |alert| > |crit| > |err| > |warning| > |notice| > |info| > |debug| > i. 1, 2, 3 > ii. 2, 3 > iii. 1, 2, 3 > 不確定 > [name=Eugene@20191106-14:50] ### C ``` !sudo \*.\* /var/log/sudo.log ``` ### D > size: * > 不要 trim > when: $M1D0 > 每個月的一號的00:00 > [name=Eugene@20191106-14:59] 每一行的開始為要翻轉的日誌名稱、接著是供翻轉與新建檔案使用的擁有者及群組 (選填)。mode 欄位可設定日誌檔案的權限,count 代表要保留多少個翻轉過的日誌檔案,而 size 與 when 欄位會告訴 newsyslog 何時要翻轉該檔案。日誌檔案會在當其檔案超過 size 欄位的大小或已超過 when 欄位指定的時間時翻轉,可使用星號 (*) 忽略該欄位。flags 欄位可以給予進階的參數,例如:如何壓縮翻轉後檔案或建立遺失的日誌檔案。最後兩個欄位皆為選填,可指定程序的程序 ID (PID) 檔名稱以及檔案翻轉後要傳送給該程序的信號 (Signal) 編號。 ## 第18題 > 三個字的都不見 > [name=Eugene@20191106-15:03] ![](https://i.imgur.com/3VbU3aZ.png) ## 第19題 ### A `a b c` ### B `Result:$var` ### C Result:a b c > ``` > Result: a > b > c > ``` > 這是我跑出來的 ( ˘・з・) > [name=Eugene@20191106-15:06] ## 第20題 ??? ## 第21題 ### A $* :all arguments are formed into a long string $@ :all arguments are formed into separated strings ### B `$$`:process number of current command ## 第22題 > tunneled through SSH/TLS channel > SSH: command 跟 data 都會 encrypted while transmitting > TLS: 只有 command (better performance) > [name=Eugene@20191106-15:09] ## 第23題 ??? # 2016 part C ## 第一題 ### 1 `sed -e /^word/d` ### 2 `awk '{if($1 !~ /word/) {print $1}}'` ## 第二題 > `lsof | awk '{if($5 ~ /VREG/) { print "file: "$8"\n|---- user: "$3"\n|---- command: "$1}}'` > [name=Eugene@20191106-21:11] ## 第三題 shebang ## 第四題 snapshot的資料夾(一般在.zfs/snapshot/snapshot_name/*)中可以找到相關資料,把檔案複製回來就好 ## 第五題 partition type GUID:分割區類型的GUID unique partition GUID:該分割區本身的GUID ## 第六題 ??? ## 第七題 file:(rw-rw-rw-) - (------rwx) = (rw-rw----) dir:(rwxrwxrwx) - (------rwx) = (rwxrwx---) ## 第八題 在GPT分割區表的最開頭,出於相容性考慮仍然儲存了一份傳統的MBR,用來防止不支援GPT的硬碟管理工具錯誤辨識並破壞硬碟中的資料,這個MBR也叫做保護MBR。在支援從GPT啟動的作業系統中,這裡也用於儲存第一階段的啟動程式碼。在這個MBR中,只有一個標識為0xEE的分割區,以此來表示這塊硬碟使用GPT分割區表。不能辨識GPT硬碟的作業系統通常會辨識出一個未知類型的分割區,並且拒絕對硬碟進行操作,除非用戶特別要求刪除這個分割區。這就避免了意外刪除分割區的危險。另外,能夠辨識GPT分割區表的作業系統會檢查保護MBR中的分割區表,如果分割區類型不是0xEE或者MBR分割區表中有多個項,也會拒絕對硬碟進行操作。 ## 第九題 setuid

    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