砍敺 IT_man 2018-9-13 18:28 蝺刻摩 " W0 O0 Y9 _) `3 n" a P3 W' P
2 C$ P% V# E6 ?1 ^" `祉銝餉隞蝝孵linux client 撣唾撖蝣廣sh(Secure shell)追inux server銋閰喟敦蝔甇仿:
6 e" a, ~8 B. h5 P6 n8 r* O# f! W
2 j B! k+ h8 U) n7 |<1> 每lient蝡舐YClient:% f( f: O9 H T+ A
4 y O2 E# ^5 {' h& k& s+ {閮剖牢lient蝡臭誑雿輻刻 user1 餃,摰嗥桅 .ssh 桅鋆∴桀芣銝 known_hosts 瑼獢嚗舐其閮曄蝺啣亙啁server SSH Server 祇啜
$ x# F3 p: Z; a6 b9 Z0 z1 Z3 ]& r4 I靘,Y銝蝯軏lient SSH 祇+蝘堆閮剜臭蝙 RSA 瞍蝞瘜 ==> ssh-keygen 隞 :
! a4 i e! { L8 c; i5 K2 A0 m& f* _5 }7 T" u
2 N* F. m0 j* r; R; x
6 S1 x$ P9 L1 T" u3 d+ n- o
: ?& Y3 @5 G, t/ P2 G蝔銝賊閬雿輻刻閮剖,銝敹靽格,券函湔交 Enter 券閮剖澆停憟賭5 e# k' h: s; ]5 _9 z
1. Enter file in which to save the key - 頛詨仿啁瑼獢頝臬蝔梧閮剜 ~/.ssh/id_rsa
7 |) _2 T8 y7 J, }6 i B2. Enter passphrase - 頛詨亥芾撖蝣潦
1 L! L9 n' h: j5 r* Y3. Enter same passphrase again - 頛詨乩甈∟芾撖蝣潦& _: N, g- b: R' k2 l( S
7 n0 K# |1 F3 l
甇斗摰撠望Y id_rsa 蝘啣 id_rsa.pub 祇啜祇啁批捆嚗嗅祕撠勗芣臭撖摮撌脯8 S" U4 D0 D# ~
雿輻 scp ftp 雿蝧瑼獢唾撓撌亙瑕 Client 蝡舐祇 ~/.ssh/id_rsa.pub 銴鋆賢 Server蝡航ㄐ,撣唾閮凋真ser1,暻澆停祇啣 user1 摰嗥桅 ~ % {: [, `# J9 n: f/ z) m
; R. p. t- [+ N' E8 G
<2> Server蝡臬亙Client蝡舐Y祇:
9 N2 k8 G, m* ?1 c6 p5 u
- a+ \' u" Z$ I( y M沒SH頠擃,閮凋誑Putty Server蝡,user1餃亙蝣箄銝銝 Client 祇 id_rsa.pub 撌脩鋡怨鋆賡脖,憒摰嗥桅瘝 .ssh 桅撠梯芾撱箇3 y& A P( G) c% a) I$ [
.ssh 桅甈寞芣砌犖航撖,璅瘥頛摰具
) m+ n& E$ \% v, X- n8 [+ A2 pchmod 700 ~/.ssh3 g) [6 a* P8 ^6 w7 X( d
銴鋆賡靘 Client 蝡臬祇堆臬亙 Server蝡舐甈皜(authorized_keys)鋆∼
* \7 L# H$ j! |/ ^5 C9 o8 Icat ~/id_rsa.pub >> ~/.ssh/authorized_keys/ z# b+ l$ T. r G% {9 W5 G
$ B, v/ A8 I# {% t6 V6 \璅 authorized_keys 瑼獢甈芣砌犖航撖,璅瘥頛摰具
7 q) H+ v, T6 H" Zchmod 600 ~/.ssh/authorized_keys
/ F/ Y- r# H( r# ~$ O5 g% U+ T& {* v# o
) H# u3 E& i0 P9 V U+ l' R( q7 r% }( {7 [) ?
蝯:1 n( W8 `7 ~ @
祉餃亦嚗閰W撣唾頝撖蝣潦撠 Client 蝡舐祇啣 Server蝡 甈桀,撠勗臭誑湔亦餃乩典董撖蝣潔,臭臬嫣噶,銝蝬SSH撖唾撓游具0 C$ b$ S* j6 q- |: C X r2 B8 m5 Q
孵亥牧:銝Y甇仿芣靘Client蝡舐雿輻刻user1撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻user1;憒Client蝡舐雿輻刻user1甈脣撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻root閰,甇仿<2>user1root,袖erver蝡舫隞叵oot餃,嗡雿賭璅
" q3 ]4 d0 _% ^. T O% b0 ]* q5 U8 F5 G2 I
& _: j; Z: K9 K# YP.S 單澆Windows 撖蝣廣sh(Secure shell)追inux server,隢 http://blog.itist.tw/2015/03/login-ssh-server-without-username-and-password.html
2 Q7 m/ A. l/ q# A
) q7 `- I( j' `9 z D* R |
|