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