chmod with ssh key

chmod 是由 change mode 所組成,其指令功能便是更改檔案或者資料夾底下所有檔案的權限。 而權限位是由 9 個權限位來控制,每 3 位為一組,分別為

  • User
  • Group
  • Other

chmod 的八進位語法的數字說明:

  • r: read – 4
  • w: write -2
  • x: execute – 1 所以,舉個例子: 5 = 可讀可執行(4 + 1) 6 = 可讀可寫(4 + 2) 7 = 可讀可寫可執行(4 + 2 + 1) 那麼,chmod 600 則就代表著 User 可讀可寫,但 Group 和 Other 則無法使用。

chmod ssh key

若我們更改一下 ssh 的 private key,會發生什麼事呢?

如圖片測試結果所示,ssh 的 private key 僅能開放 User 的權限, Group 和 Other 則都不能開放,否則就會無法使用。

Licensed under CC BY-NC-SA 4.0
comments powered by Disqus