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涔熷彲浠ヤ笉鐢ㄥ瘑鐮佺櫥褰曚簡銆