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
    • 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 Versions and GitHub Sync Note Insights 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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    ###### tags : `1062` [LSA](https://hackmd.io/c/By4H6JLNW/) # LSA 1062 Week02 共筆 - [var是什麼?](https://zhidao.baidu.com/question/398779738.html) > [name=百度][time=Thu, Mar 8, 2018 8:14 PM][color=#dd9573] >/var 包含系统一般运行时要改变的数据。通常这些数据所在的目录的大小是要经常变化或扩充的。原来 /var 目录中有些内容是在 /usr 中的,但为了保持 /usr 目录的相对稳定,就把那些需要经常改变的目录放到 /var 中了。每个系统是特定的,即不通过网络与其他计算机共享。下面列出一些重要的目录 ( 一些不太重要的目录省略了 ) 。 - [FHS檔案系統階層標準](https://zh.wikipedia.org/wiki/%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E5%B1%82%E6%AC%A1%E7%BB%93%E6%9E%84%E6%A0%87%E5%87%86) - `$chown` or `$chgrp` - [userdir](https://dywang.csie.cyut.edu.tw/dywang/rhel7/node39.html):每個使用者在自己家裡面有一個目錄,自動變成各使用者的家目錄。 - [inetd](http://linux.vbird.org/linux_basic/0560daemons.php) v.s. [xinetd](http://canred.blogspot.tw/2013/03/xinetd-tcpxinetd.html) - rsync (自動執行檔案同步化) hen 好用 - rsync v.s. scp? - scp沒辦法制定server - 如果只設定一次:scp - 若要雙向同步:rsync - 傳輸時想要壓縮請用 rsync - [init層級](http://nmc.nchu.edu.tw/tanet/Linux_boot.htm) - ![](https://img.lsa.tw/G2vDHX4.png) - :star:沒事別用 init.d 關機,不會叫其他服務儲存 ram 中資料 - poweroff (會導致資料庫資料未完全寫進時關機) - [useradd v.s. adduser](http://os.51cto.com/art/201104/256231.htm) adduser會呼叫 useradd來幫它做事情(useradd不會加自動加 home目錄) useradd -p 要輸入雜湊後的密碼.... - `$su - {username}`: 切換使用者:no_entry: - `$sudo su - root` : 千萬不要用:no_entry: - 盡量別用 su,盡量用 sudo,<font color=red>但最好是依據group制定對應的權限</font>,否則查起來,不懂是誰經手,只知道是root/sudoers - 新建的user或group id通常是1000以上 - `$/etc/skel` (改內容後再adduser會有何不同?) - 對某資料夾權限作修改,則新增之user所產生資料夾依權限設定產生 - exist user不受影響 - /etc/init.d - `$cat /etc/fstab ` - `df -h` 資料哪裡來? `mount`? 他們跟一個硬碟分割區中的設定檔案 - ls /etc/rc* ? 裡面的 file 會 link 到 '/init.d/' 裏面,而檔案開頭的 K 代表 KILL, S 則代表 STARAT[LINUX啟動程序](http://nmc.nchu.edu.tw/tanet/Linux_boot.htm) - run 裡面的 sudo 是做什麼的? >- man sudo裏面有提到 dev link 系統所有h/w 入侵網頁後, 1. /var/www 2. /tmp (default 777) 3. /var/log 4. /dev/shm 5. who/last/lastlog --- 1. bin 目錄到底是作啥用,以及系統下到底有幾個bin `/bin`:如常在單用戶模式可用的必要命令用的命令ls、tar、mv、cat等。 `/sbin`:放置必要的系统二進制文件,_例如:init、 ip、 mount。 <font color=red>just for root</font> `/usr/bin`:放置可執行程式,這個目錄的檔案與/bin 幾乎是相同的 `/usr/sbin`:放置管理者使用程式,與 /sbin 相同 ### 千萬不要分享:no_entry: `.ssh/` 和 `GPG` 2. tmp資料夾用意,生命週期多久,什麼狀況下會消失?stickid? reboot to clear. - 這是讓一般使用者暫時存放檔案的地方,例如你在安裝 Linux 下的軟體時,可能/tmp就是軟體預設的工作目錄。 - 在系统重启後目录中文件不会被保留。 - 有空常用 `ls -al` 看有沒有惡意檔案 - `sudo gedit /etc/default/rcS` 把TMPTIME=0,修改成TMPTIME=-1或者是无限大,系统在重新启动後就不会清理你的/tmp目录了。另外,修改之后,以前被系统删除的文件(我的是图片)会自动复原,只是名字改变了。 3. [如何檢查目前cpu?](https://magiclen.org/linux-view-cpu/) - `$cat /proc/cpuinfo` - top - htop (好用) `$sudo apt install htop` before using - uptime - lscpu 4. 檢驗系統目前安全狀態蠻有用的tools - unhide - chkrootkit - rkhunter 4. root 為什麼不在home內,適不適合獨立分割? - 這是系統安全權限方面的設定。 - root是超級管理員,和普通用戶是有區別的,兩個目錄的權限也是不一樣的。 - root用戶擁有系統最高權限,在根目錄下給root一個單獨的目錄,這是系統設定好的。 - [資料源](https://zhidao.baidu.com/question/1112565815234529819.html) > [name=BT] > 情景:硬碟損壞,可開機但無法真正開機(電源通,系統損毀) > 資料救援用 > [Busybox](https://zh.wikipedia.org/wiki/BusyBox) 5. sbin是放什麼東西,為什麼需要獨立? - 必要的系统二进制文件,_例如:_ init、 ip、 mount。 6. var: 放極容易變動的資料 7. 備份,debian 存放備份的地方在哪?索引檔? - /var/backups - /backup 9. run、srv: 為目的性、暫時性的目錄,也會存放使用者安裝的軟體 NaNundefined[name=俊甫][color=#dd9573] NaNundefinedwhile a program is running, it will append a tmp(special) file in `/run`. and it will occur errors if the process exist. NaNundefined/srv: 會被不遵守 FHS 的程式放一些?? 10. sys較新 11. webfs, [sshfs](https://blog.gtwang.org/linux/sshfs-ssh-linux-windows-mac-os-x/), nfs, samba 自動讓伺服器遠端 mount (FSTAB?) 12. lib & lib64差別,用途? > [name=逸于yiyu] 64位元的系統只要裝32位元的lib也能執行32位元的檔案 ![](https://img.lsa.tw/Fhcdfhd.png) ![](https://img.lsa.tw/Qq1ZZUc.png) - [資料源](https://books.google.com.tw/books?id=iiJEDwAAQBAJ&pg=SA2-PA14&lpg=SA2-PA14&dq=lib%E5%92%8Clib64%E5%B7%AE%E7%95%B0&source=bl&ots=z-jnEAeoCW&sig=ZQFjAGH-aXKLtDCZ4E3ZVlFGJg8&hl=zh-TW&sa=X&ved=0ahUKEwjF-7bqztzZAhWBMJQKHZ4EBn8Q6AEIazAH#v=onepage&q=lib%E5%92%8Clib64%E5%B7%AE%E7%95%B0&f=false) - [ubuntu根目錄各資料夾的功能](http://www.arthurtoday.com/2012/12/ubuntu-file-system-tree-directories.html) 12. Network - MTU - IP/TCP/UDP/BGP/ICMP - What is IP prefix? - How FTP transport data? Which port does FTP use? - How DNS work under UDP? - What is MAC Adress? - hping3 13. What's the different between ubuntu(unity) & ubuntu(gnome)? - https://askubuntu.com/questions/333237/difference-between-unity-and-gnome - http://m.manew.com/thread-29169-1-1.html 14. /dev/shm will put some files would not be store to disk. - 有一半記憶體大小的空間 15. 善用 who, last, lastlog # homework - mount remote server's folder?

    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