砍敺 IT_man 2018-9-13 18:28 蝺刻摩
3 b, J J$ y) d
' |- d: _% D6 n' }, p9 I: @+ m祉銝餉隞蝝孵linux client 撣唾撖蝣廣sh(Secure shell)追inux server銋閰喟敦蝔甇仿:
9 J. {" H, v- o, p$ M! p
1 i) T8 r. J+ x" u4 ~7 W<1> 每lient蝡舐YClient:: q; K$ R) \3 `* [: M8 {
: c9 a/ i7 a+ C) b- t% _閮剖牢lient蝡臭誑雿輻刻 user1 餃,摰嗥桅 .ssh 桅鋆∴桀芣銝 known_hosts 瑼獢嚗舐其閮曄蝺啣亙啁server SSH Server 祇啜) L* z4 X2 l; M0 p' S
靘,Y銝蝯軏lient SSH 祇+蝘堆閮剜臭蝙 RSA 瞍蝞瘜 ==> ssh-keygen 隞 :
: C% i% m" k/ u5 [$ ^( J" |* \& n% e2 T
8 s! M% G; ^. B" _5 k1 v, A. p/ y5 q+ K
! J4 S% R5 o4 u8 k* R" i& ^7 R# |蝔銝賊閬雿輻刻閮剖,銝敹靽格,券函湔交 Enter 券閮剖澆停憟賭$ E! ?% [ r0 c. ]/ T) N- f6 H
1. Enter file in which to save the key - 頛詨仿啁瑼獢頝臬蝔梧閮剜 ~/.ssh/id_rsa; v) X2 C2 G! b. N- b
2. Enter passphrase - 頛詨亥芾撖蝣潦/ X Z; M! [5 K5 _% U$ h% }
3. Enter same passphrase again - 頛詨乩甈∟芾撖蝣潦5 i$ e% h. g- g0 r' K) p; }
9 F, W+ O; p' H/ r/ H: ]: Y" [' J甇斗摰撠望Y id_rsa 蝘啣 id_rsa.pub 祇啜祇啁批捆嚗嗅祕撠勗芣臭撖摮撌脯
4 k8 J" h& l# `6 D4 I雿輻 scp ftp 雿蝧瑼獢唾撓撌亙瑕 Client 蝡舐祇 ~/.ssh/id_rsa.pub 銴鋆賢 Server蝡航ㄐ,撣唾閮凋真ser1,暻澆停祇啣 user1 摰嗥桅 ~
& Z9 w7 m! w, g6 p- ~6 ]3 `( i9 X8 P' h9 m% c- ^; P5 i7 S* M' t
<2> Server蝡臬亙Client蝡舐Y祇:' z+ O- c3 q* X
( S6 h; {& {4 R4 s
沒SH頠擃,閮凋誑Putty Server蝡,user1餃亙蝣箄銝銝 Client 祇 id_rsa.pub 撌脩鋡怨鋆賡脖,憒摰嗥桅瘝 .ssh 桅撠梯芾撱箇1 m% h, X& z6 s0 G/ u
.ssh 桅甈寞芣砌犖航撖,璅瘥頛摰具
! ` i- J% K$ b }7 Cchmod 700 ~/.ssh, W+ `' N( Y5 {3 E# w
銴鋆賡靘 Client 蝡臬祇堆臬亙 Server蝡舐甈皜(authorized_keys)鋆∼ 9 N" [' A+ p) N+ U8 t
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys2 `4 R3 h/ ^* \, b% L6 t
" L/ F; ?, w% |* Q; q
璅 authorized_keys 瑼獢甈芣砌犖航撖,璅瘥頛摰具
1 X# g: Z, I3 i! q, ^, B; _2 Y0 \+ B% |chmod 600 ~/.ssh/authorized_keys( C0 V. W, `0 T
- E( U1 p9 G: H4 ~
( y; _! k9 C, @( |3 e* Y0 f/ w5 W: v7 r* s8 _6 S
蝯:
/ l% U& {7 K/ |# N1 A祉餃亦嚗閰W撣唾頝撖蝣潦撠 Client 蝡舐祇啣 Server蝡 甈桀,撠勗臭誑湔亦餃乩典董撖蝣潔,臭臬嫣噶,銝蝬SSH撖唾撓游具# e2 ^/ ^ {; N( ^3 ^) c
孵亥牧:銝Y甇仿芣靘Client蝡舐雿輻刻user1撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻user1;憒Client蝡舐雿輻刻user1甈脣撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻root閰,甇仿<2>user1root,袖erver蝡舫隞叵oot餃,嗡雿賭璅
, W5 L' v& e$ V3 Y
7 y) ?7 Z+ _8 v" p. b1 n, @; {' B4 k+ c" u0 d8 w% L
P.S 單澆Windows 撖蝣廣sh(Secure shell)追inux server,隢 http://blog.itist.tw/2015/03/login-ssh-server-without-username-and-password.html. M' \ P* a; y% l
! P& \6 Y7 `8 n" ^
|
|