Debian 503版本中實現的,Debian默認好像是沒有ssh支持的。
SSH的安裝apt-get install openssh-serverapt-get install sshSSH的配置OpenSSH的配置都集中在/etc/ssh/ssh_config文件中編輯“ssh_config”文件(vim /etc/ssh/ssh_config),添加或改變下面的參數:
# Site-wide defaults for various optionsHost *ForwardAgent noForwardX11 noRhostsAuthentication noRhostsRSAAuthentication noRSAAuthentication yesPassWordAuthentication yesFallBackToRsh noUseRsh noBatchMode noCheckHostip yesStrictHostKeyChecking noIdentityFile ~/.ssh/identityPort 22Cipher blowfishEscapeChar ~
下面逐行說明上面的選項設置: www.111cn.net
Host *選項“Host”只對能夠匹配后面字串的計算機有效。“*”表示所有的計算機。
ForwardAgent no“ForwardAgent”設置連接是否經過驗證代理(如果存在)轉發給遠程計算機。
ForwardX11 no“ForwardX11”設置X11連接是否被自動重定向到安全的通道和顯示集(DISPLAY set)。
RhostsAuthentication no“RhostsAuthentication”設置是否使用基于rhosts的安全驗證。
RhostsRSAAuthentication no“RhostsRSAAuthentication”設置是否使用用RSA算法的基于rhosts的安全驗證。
RSAAuthentication yes“RSAAuthentication”設置是否使用RSA算法進行安全驗證。
PasswordAuthentication yes“PasswordAuthentication”設置是否使用口令驗證。
FallBackToRsh no“FallBackToRsh”設置如果用ssh連接出現錯誤是否自動使用rsh。
UseRsh no“UseRsh”設置是否在這臺計算機上使用“rlogin/rsh”。
BatchMode no“BatchMode”如果設為“yes”,passphrase/password(交互式輸入口令)的提示將被禁止。當不能交互式輸入口令的時候,這個選項對腳本文件和批處理任務十分有用。
CheckHostIP yes“CheckHostIP”設置ssh是否查看連接到服務器的主機的IP地址以防止DNS欺騙。建議設置為“yes”。
StrictHostKeyChecking no“StrictHostKeyChecking”如果設置成“yes”,ssh就不會自動把計算機的密匙加入“$HOME/.ssh/known_hosts”文件,并且一旦計算機的密匙發生了變化,就拒絕連接。SSH#服務器端配置 /etc/ssh/sshd_config#只考慮協議版本2#全局配置VersionAddendum TecZm-20050505 #在telnet ip 22時只能看出openssh的版本,看不出OSPRotocol 2 #使用協議版本2Port 22 #sshd監聽22端口ListenAddress 192.168.7.1 #sshd只監聽目標ip為192.168.7.1的請求AllowGroups wheel myguest #允許wheel組和myguest組的用戶登錄AllowUsers teczm [email protected] #允許來自以上組的teczm用戶和authen用戶登錄,#且authen用戶只能從主機192.168.8.5登錄#DenyGroups #拒絕登錄的組,參數設置和AllowGroups一樣#DenyUsers #拒絕登錄的用戶,參數設置和AllowUsers一樣#AllowTcpForwarding yes #是否轉發的TCP包都被允許。默認是 “yes”。LoginGraceTime 60 #60秒內客戶端不能登錄即登錄超時,sshd切斷連接。KeyRegenerationInterval 1800 #1800秒(30分鐘)后自動重新生成服務器的密匙。MaxStartups 3 #設置同時發生的未驗證的并發量,即同時可以有幾個UseDNS no #不使用DNS查詢客戶端。PermitRootLogin no #不允許root登錄,root可由wheel組用戶登錄后su。X11Forwarding no #禁止用戶運行遠程主機上的X程序,我沒有X,所以無所謂。UseLogin yes #禁止X11Forwarding#認證配置(口令認證、PAM認證、非對稱密鑰認證任選其一)#口令認證PubkeyAuthentication no #不使用非對稱密鑰認證PasswordAuthentication yes #使用口令認證PermitEmptyPasswords no #不允許使用空密碼的用戶登錄#PAM認證PasswordAuthentication no #不使用口令認證UsePAM #使用pam認證ChallengeResponseAuthentication yes #允許挑戰應答方式#非對稱密鑰認證PasswordAuthentication no #不使用口令認證PubkeyAuthentication yes #使用非對稱密鑰認證AuthorizedKeysFile .ssh/authorized_keys #用戶認證使用的公鑰。
更多詳細內容請查看:http://www.111cn.net/sys/linux/57339.htm
新聞熱點
疑難解答