linux無密碼登陸
1、首先在電腦桌面上點擊開始進入運行窗口。
⑵ 濡備綍閫氳繃linux ssh榪滅▼linux涓嶇敤杈撳叆瀵嗙爜鐧誨叆
濡備綍閫氳繃涓鍙發inux ssh榪滅▼鍏朵粬linux鏈嶅姟鍣ㄦ椂錛屼笉瑕佽緭鍏ュ瘑鐮侊紝鍙浠ヨ嚜鍔ㄧ櫥鍏ャ傛彁楂樿繙紼嬫晥鐜囷紝涓嶇敤璁板繂鍚勫彴鏈嶅姟鍣ㄧ殑瀵嗙爜銆
棣栧厛鐧誨叆涓鍙發inux鏈嶅姟鍣錛屾ゅ彴鍋氫負姣嶆満錛堝嵆鐧誨叆鍏朵粬linux緋葷粺鐢ㄨ繖鍙板仛涓哄叆鍙o級錛涙墽琛屼竴琛屽懡浠ょ敓鎴恔ey鏂囦歡錛歴sh-keygen -t rsa
鍦ㄦ瘝鏈轟笂錛岃繘鍏/roo/.ssh鐩褰曪紝鎵懼埌id_rsa.pub璇ユ枃浠訛紝榪欎釜鏂囦歡灝辨槸鍒氭墠鎵ц宻sh-keygen鎵鐢熸垚鐨勫叕閽key鏂囦歡銆
鐢╯cp鍛戒護錛屽皢姣嶆満浜х敓鐨刱ey鎷蜂竴浠藉埌榪滅▼鐨刲inux鏈嶅姟鍣ㄤ笂錛屽苟鍛藉悕鎴恆uthorized_keys錛泂cp ~/.ssh/id_rsa.pub [email protected]:/root/.ssh/authorized_keys銆傝繖涓姝ョ殑鎿嶄綔闇瑕佹墜鍔ㄨ緭鍏ュ瘑鐮併
鐜板湪涓烘錛屼綘宸插畬鎴愪簡鎵鏈夌殑鎿嶄綔錛涘彲鍦ㄦ瘝鏈洪氳繃ssh [email protected] 浣犱細鍙戠幇涓嶅湪鐢ㄨ緭鏀懼瘑鐮佷簡銆傜浉鍚岀殑scp鍛戒護涔熸槸涓鏍風殑鎯呭喌錛屾棤闇鎵嬪姩杈撳叆瀵嗙爜銆
⑶ Linux鎬庝箞閰嶇疆鍙屾満SSH浜掔浉淇′換瀹炵幇鍏嶅瘑鐮佺櫥褰
鍚勪綅濂斤紝鏈綃囧皢閫氳繃涓ゅ彴鏈哄櫒鐨勯厤緗浠嬬粛濡備綍瀹炵幇鍙屽悜浜掔浉鐧誨綍鏃犻渶瀵嗙爜璁よ瘉銆傛湰綃囦嬌鐢ㄤ竴縐嶆柟寮忚縐頒負鍏縐侀掗璁よ瘉鐨勬柟寮忔潵榪涜宻sh鐧誨綍銆傚叕縐侀掗璁よ瘉鏂瑰紡綆鍗曠殑瑙i噴鏄錛氶栧厛鍦ㄥ㈡埛絝涓婂壋寤轟竴瀵瑰叕縐侀掗錛堝叕閽ユ枃浠訛細~/.ssh/id_rsa.pub錛涚侀掗鏂囦歡錛殈/.ssh/id_rsa錛夛紝鐒跺悗鎶婂叕閽ユ斁鍒版湇鍔″櫒涓婏紙~/.ssh/authorized_keys錛夛紝鑷宸變繚鐣欏ソ縐侀掗銆傚綋ssh鐧誨綍鏃訛紝ssh紼嬪簭浼氬彂閫佺侀掗鍘誨拰鏈嶅姟鍣ㄤ笂鐨勫叕閽ュ仛鍖歸厤銆傚傛灉鍖歸厤鎴愬姛灝卞彲浠ョ櫥褰曚簡銆備笅闈㈠皢璇︾粏浠嬬粛濡備綍閰嶇疆銆
1銆侀栧厛鎴戜滑闇瑕佺『淇濅袱鍙版満鍣ㄥ彲浠ヨ繛閫氾紝騫朵笖閮藉紑鍚浜唖sh璁よ瘉鏈嶅姟銆傛垜浠鍙浠ユ墽琛ping鍛戒護鏉ョ『淇濅袱鍙版満鍣ㄦ槸鍚﹀彲浠ヨ繛閫氥傚叿浣撴搷浣滃備笅鍥炬墍紺
2銆佺劧鍚庣『淇濇槸鍚﹂兘寮鍚浜唖shd鏈嶅姟銆傛墽琛屽懡浠ps -ef | grep sshd 鏌ョ湅鏄鍚﹀紑鍚銆傚叿浣撳睍紺哄備笅鍥炬墍紺恆
3銆佺劧鍚庢垜浠鍦ˋ鏈猴紙192.168.3.132錛変笂鐢熸垚涓瀵瑰叕閽ャ佺侀掗銆傞噰鐢ㄥ懡浠ssh-keygen -t rsa -P 鏉ヨ繘琛岀敓鎴愩傚叿浣撴搷浣滃備笅鍥炬墍紺恆
4銆佺敓鎴愬畬姣曞悗錛岀劧鍚庡皢鐢熸垚鐨勫叕閽ラ氳繃scp鍛戒護鎷瘋礉鍒癇鏈猴紙192.168.3.159錛夌殑root/.ssh/鐩褰曚笅銆傜敓鎴愮殑鍏閽ラ粯璁ょ洰褰曚負錛/root/.ssh/銆鎴戜滑鎵ц屽懡浠scp /root/.ssh/id_rsa.pub 192.168.3.159:/root/.ssh/authorized_keys鎵ц屾枃浠舵嫹璐濆伐浣滐紝鎷瘋礉鍒癇鏈轟笂鏂囦歡榪涜屼簡閲嶅懡鍚嶄負錛歛uthorized_keys銆傚叿浣撴搷浣滃備笅鍥炬墍紺恆
5銆佺劧鍚庢垜浠鍦ˋ鏈轟笂閫氳繃ssh榪炴帴B鏈哄苟鎵ц屽懡浠date,鏌ョ湅B鏈虹殑鏃墮棿銆傛垜浠鎵ц屽懡浠わ細ssh 192.168.3.159 date鍙浠ョ湅鍒頒笉闇瑕佽緭鍏ュ瘑鐮佸氨鍙浠ョ櫥褰旴鏈轟簡銆傚叿浣撳睍紺哄備笅鍥炬墍紺恆傛垜浠宸茬粡閰嶇疆濂戒簡A鏈虹櫥褰旴鏈轟笉闇瑕佸瘑鐮佺殑鏂瑰紡銆
6銆佸悓鏍峰湪B鏈轟笂鎴戜滑鎵ц屽懡浠ssh-keygen -t rsa -P ,鐢熸垚涓瀵瑰叕閽ャ佺侀掗銆傚叿浣撴搷浣滃備笅鍥炬墍紺恆
7銆佺劧鍚庡皢鐢熸垚鐨勫叕閽ラ氳繃scp鍛戒護錛屾嫹璐濆埌A鏈猴紙192.168.3.132錛変笂銆傛ゅ勬墽琛屽懡浠scp /root/.ssh/id_rsa.pub 192.168.3.132:/root/.ssh/authorized_keys,鎷瘋礉鍒癆鏈轟笂鏂囦歡鍚嶇О涓篴uthorized_keys銆傚叿浣撴搷浣滃備笅鍥炬墍紺恆
8銆佺劧鍚庡悓鏍鋒垜浠鍦˙鏈猴紙192.168.3.159錛変笂鎵ц屽懡浠ssh 192.168.3.132 date涓嶉渶瑕佽緭鍏A鏈哄瘑鐮佸氨鍙浠ュ緱鍒癆鏈虹殑鏃墮棿銆傚叿浣撴搷浣滃備笅鍥炬墍紺恆