天天看點

suse10配置“/etc/ssh/sshd_config”檔案

“/etc/ssh/sshd_config”是OpenSSH的配置檔案,允許設定選項改變這個daemon的運作。這個檔案的每一行包含“關鍵詞- 值”的比對,其中“關鍵詞”是忽略大小寫的。下面列出來的是最重要的關鍵詞,用man指令檢視幫助頁(sshd (8))可以得到詳細的清單。

編輯“sshd_config”檔案(vi /etc/ssh/sshd_config),加入或改變下面的參數:

# This is ssh server systemwide configuration file.

Port 22

ListenAddress 192.168.1.1

HostKey /etc/ssh/ssh_host_key

ServerKeyBits 1024

LoginGraceTime 600

KeyRegenerationInterval 3600

PermitRootLogin no

IgnoreRhosts yes

IgnoreUserKnownHosts yes

StrictModes yes

X11Forwarding no

PrintMotd yes

SyslogFacility AUTH

LogLevel INFO

RhostsAuthentication no

RhostsRSAAuthentication no

RSAAuthentication yes

PasswordAuthentication yes

PermitEmptyPasswords no

AllowUsers admin

下面逐行說明上面的選項設定:

   “Port”設定sshd監聽的端口号。

   “ListenAddress”設定sshd伺服器綁定的IP位址。

    “HostKey”設定包含計算機私人密匙的檔案。

     “ServerKeyBits”定義伺服器密匙的位數。

     “LoginGraceTime”設定如果使用者不能成功登入,在切斷連接配接之前伺服器需要等待的時間(以秒為機關)。

    “KeyRegenerationInterval”設定在多少秒之後自動重新生成伺服器的密匙(如果使用密匙)。重新生成密匙是為了防止用盜用的密匙解密被截獲的資訊。

   “PermitRootLogin”設定root能不能用ssh登入。這個選項一定不要設成“yes”。

   “IgnoreRhosts”設定驗證的時候是否使用“rhosts”和“shosts”檔案。

    “IgnoreUserKnownHosts”設定ssh daemon是否在進行RhostsRSAAuthentication安全驗證的時候忽略使用者的“$HOME/.ssh/known_hosts”

     “StrictModes”設定ssh在接收登入請求之前是否檢查使用者家目錄和rhosts檔案的權限和所有權。這通常是必要的,因為新手經常會把自己的目錄和檔案設成任何人都有寫權限。

      “X11Forwarding”設定是否允許X11轉發。

      “PrintMotd”設定sshd是否在使用者登入的時候顯示“/etc/motd”中的資訊。

      “SyslogFacility”設定在記錄來自sshd的消息的時候,是否給出“facility code”。

      “LogLevel”設定記錄sshd日志消息的層次。INFO是一個好的選擇。檢視sshd的man幫助頁,已擷取更多的資訊。

     “RhostsAuthentication”設定隻用rhosts或“/etc/hosts.equiv”進行安全驗證是否已經足夠了。

      “RhostsRSA”設定是否允許用rhosts或“/etc/hosts.equiv”加上RSA進行安全驗證。

       “RSAAuthentication”設定是否允許隻有RSA安全驗證。

      “PasswordAuthentication”設定是否允許密碼驗證。

       “PermitEmptyPasswords”設定是否允許用密碼為空的帳号登入。

      “AllowUsers”的後面可以跟着任意的數量的使用者名的比對串(patterns)或user@host這樣的比對串,這些字元串用空格隔開。主機名可以是DNS名或IP位址。

本文轉載于:http://gg-jgs.blog.sohu.com/62725526.html

繼續閱讀