A. linux鍏閽ヤ笌縐侀掗linux鍏閽ョ侀掗瀵
Linux瀹㈡埛絝濡備綍鍔犺澆ssh縐侀掗錛
鐐瑰嚮紜瀹氬姞杞芥垚璇曟牱錛屼竴瀹氳佺偣鍑葷『瀹氬姞杞斤紝鎶婁粬璁捐℃垚榪欐牱錛岀偣鍑葷『瀹氬姞杞芥垨鑰呬笅杞借蔣浠跺嚭鏉ワ紝涓嬭澆涔嬪悗錛岀劧鍚庡姞杞芥垚鎶婂畠鏀規垚榪欎釜涓滆タ灝辮屼簡
linux涓濡備綍鏌ョ湅瀵嗗寵錛
1.
棣栧厛榪涘叆鍒發inux妗岄潰,鍦ㄥ彸鍑繪岄潰,鍗曞嚮鎵撳紑緇堢銆
2.
-3/etc/passwd鍙浠ョ湅鏌ュ墠涓夊瘑鐮併
3.
鍥炶濺榪欏悗灝卞彲浠ョ湅鍒板墠涓夎岀殑瀵嗙爜淇濆瓨鐨勪綅緗銆
4.
鍦ㄨ緭鍏cat/etc/shadow,鍥炶濺銆
linux鏈嶅姟鍣ㄤ紶鏂囦歡濡備綍涓嶇敤杈撳瘑鐮侊紵
棣栧厛闇瑕佸湪鏈嶅姟鍣ㄧ璁劇疆/etc/ssh/sshd_config
#vim/etc/ssh/sshd_config
淇鏀瑰備笅涓よ屼負yes銆傚叾瀹炲ぇ澶氭暟鎯呭喌涓嬩笉鐢ㄤ慨鏀癸紝榛樿ゅ氨鏄痽es銆
RSAAuthenticationyes
PubkeyAuthenticationyes
(1)濡傛灉瀹㈡埛鏈哄拰鏈嶅姟鍣ㄩ兘鏄疞inux鏈哄櫒錛岄偅涔堟垜浠浣跨敤涓嬮潰鐨勬柟娉曪細錛堝悗闈㈢2鑺備細鎻愬埌鎬庝箞鍦╓indows涓嬩嬌鐢≒utty鐢熸垚瀵嗛掗瀵癸級
鎴戜滑闇瑕佸湪瀹㈡埛絝鐢熸垚RSA瀵嗛掗瀵廣備嬌鐢╯sh-keygen鍛戒護錛
#ssh-keygen-trsa
鍙傛暟t鐨勬剰鎬濇槸type錛屽悗闈㈣窡鐫鍔犲瘑綾誨瀷錛岃繖閲屾垜浠鏄痳sa銆
鐒跺悗浼氭彁紺轟綘杈撳叆瀵嗛掗淇濆瓨瀹屾垚鏂囦歡鍚嶏紝榪欓噷鎴戜滑闇瑕佷嬌鐢ㄩ粯璁ょ殑id_rsa錛屼箣鍚庢墠鑳芥e父鎵嶈兘鐧誨綍銆傚傛灉浣犵敓鎴愮殑瀵嗛掗浣滀負鍏朵粬鐢ㄥ勶紝閭d箞鍙浠ュ懡鍚嶄負鍏朵粬鍚嶇О錛
Generatingpublic/privatersakeypair.
Enterfileinwhichtosavethekey(/home/cake/.ssh/id_rsa):
涔嬪悗浼氭彁紺轟綘杈撳叆涓涓猵assphrase錛屾垜浠榪欓噷鍙浠ョ暀絀猴紝榪欐牱鎴戜滑鐧誨綍鐨勬椂鍊欏氨涓嶈歌緭鍏ュ瘑鐮併
Enterpassphrase(emptyfornopassphrase):
Entersamepassphraseagain:
鐒跺悗浼氭彁紺轟綘瀵嗛掗鐢熸垚鎴愬姛銆傝繖鏄浣犵殑縐侀掗淇濆瓨涓簙/.ssh/id_rsa錛屼綘鐨勫叕閽ユ槸~/.ssh/id_rsa.pub
鎴戜滑鐜板湪闇瑕佸仛鐨勬槸錛屾妸id_rsa.pub鐨勫唴瀹癸紝娣誨姞鐨勬湇鍔″櫒絝鐨剘/.ssh/autherized_keys鏂囦歡鏈鍚庛
浣犲彲浠ユ妸榪欎釜鏂囦歡涓婁紶鍒版湇鍔″櫒絝錛岀劧鍚庝嬌鐢ㄥ懡浠わ細
#catid_rsa.pub>>~/.ssh/autherized_keys
鍒拌繖閲屽氨瀹屾垚浜嗐
(2)鍦╓indows涓嬩嬌鐢≒utty鐢熸垚瀵嗛掗瀵癸細
Putty鐨勫畨瑁呯洰褰曚笅鏈変釜puttygen.exe紼嬪簭錛屾垜浠榪愯岃繖涓紼嬪簭銆
涔嬪悗鐐瑰嚮Generate錛屽紑濮嬬敓鎴愬瘑閽ュ廣傛垜浠闇瑕佹牴鎹鎻愮ず錛屽湪鎸囧畾鏂規嗗唴闅忔満婊戝姩榧犳爣銆傝繖鏄涓轟簡鏍規嵁榧犳爣杞ㄨ抗錛屼駭鐢熶竴浜涢殢鏈烘暟鎹銆
涔嬪悗鐢熸垚緇撴潫錛屾垜浠鐐瑰嚮SavePrivateKey灝嗙侀掗瀛樻斁鍦ㄦ煇涓鐩褰曚腑銆傜劧鍚庤祴鍊兼渶涓婇潰鏂囨湰妗嗕腑鐨勫叏閮ㄥ唴瀹癸紝綺樿創鍒癓inux鏈嶅姟鍣ㄧ鐨刟utherized_key鐨勬渶鍚庛
鎴戜滑鐜板湪鍙浠ュ叧闂榪欎釜灝忕▼搴忋
鐜板湪鎵撳紑Putty錛屽湪宸﹁竟鐨勯夐」涓錛岄夋嫨Conneciton_SSH_Auth錛屽湪涓錛岄夋嫨鍒氭墠淇濆瓨鐨勭侀掗璺寰勫氨鍙浠ヤ簡銆
鍒版や綅緗錛孭utty涔熷彲浠ヤ笉鐢ㄥ瘑鐮佺櫥褰曚簡銆