砍敺 IT_man 2018-9-13 18:28 蝺刻摩 0 O" e. G! }, h& H' T) ~- X
$ r! V' L6 N. J( |/ d
祉銝餉隞蝝孵linux client 撣唾撖蝣廣sh(Secure shell)追inux server銋閰喟敦蝔甇仿:
4 Y+ Q$ g, J4 y+ A! Y2 s" B7 f" `5 [! i7 ~$ G
<1> 每lient蝡舐YClient:
* _+ W' {9 {$ J- n' U9 F3 `
6 i# }3 M! T! `閮剖牢lient蝡臭誑雿輻刻 user1 餃,摰嗥桅 .ssh 桅鋆∴桀芣銝 known_hosts 瑼獢嚗舐其閮曄蝺啣亙啁server SSH Server 祇啜
: \ ?8 ^' T* h8 H3 [. `# {9 Z4 J靘,Y銝蝯軏lient SSH 祇+蝘堆閮剜臭蝙 RSA 瞍蝞瘜 ==> ssh-keygen 隞 :+ y+ Y' @. x6 H8 h+ e/ y
4 g& l: G }9 ? ^7 L
6 L* Z* I- h$ V. A8 H8 O. c+ G1 q, X
" i+ S* k) c# i# P6 M
蝔銝賊閬雿輻刻閮剖,銝敹靽格,券函湔交 Enter 券閮剖澆停憟賭
+ }6 N5 [& F5 T( n# ^: T3 B, d1. Enter file in which to save the key - 頛詨仿啁瑼獢頝臬蝔梧閮剜 ~/.ssh/id_rsa& w3 U% P2 m- p2 F
2. Enter passphrase - 頛詨亥芾撖蝣潦) e8 }/ o' O! q& S8 a
3. Enter same passphrase again - 頛詨乩甈∟芾撖蝣潦/ a$ h2 r6 a9 @/ q
9 U/ u. O! N2 w, v4 w8 D* m甇斗摰撠望Y id_rsa 蝘啣 id_rsa.pub 祇啜祇啁批捆嚗嗅祕撠勗芣臭撖摮撌脯. P" x% q. y: H, E
雿輻 scp ftp 雿蝧瑼獢唾撓撌亙瑕 Client 蝡舐祇 ~/.ssh/id_rsa.pub 銴鋆賢 Server蝡航ㄐ,撣唾閮凋真ser1,暻澆停祇啣 user1 摰嗥桅 ~
9 B9 `6 B" }% ?5 L' Z7 J
( V) y/ u: q1 d8 @- {; q<2> Server蝡臬亙Client蝡舐Y祇:
( W" ~* y5 \, k; q2 x; C9 V3 |9 {' [7 w( G4 w2 M" }# ~
沒SH頠擃,閮凋誑Putty Server蝡,user1餃亙蝣箄銝銝 Client 祇 id_rsa.pub 撌脩鋡怨鋆賡脖,憒摰嗥桅瘝 .ssh 桅撠梯芾撱箇
; `0 Z+ c) \ e3 U% P% c .ssh 桅甈寞芣砌犖航撖,璅瘥頛摰具
& C- \* {4 q. h- g$ qchmod 700 ~/.ssh
: W7 u. B, | x8 j銴鋆賡靘 Client 蝡臬祇堆臬亙 Server蝡舐甈皜(authorized_keys)鋆∼ 1 \ T5 N! Z [1 E7 L
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
% P- I; Z* z: P c: h& h# A. F
璅 authorized_keys 瑼獢甈芣砌犖航撖,璅瘥頛摰具
& {8 C W+ f6 _8 I( Cchmod 600 ~/.ssh/authorized_keys0 z2 A* \( i$ y# p4 Z, R: c
# y1 n7 e! C: C$ O2 u/ j! y1 p
) b/ z$ V) r7 d9 f& F1 H0 `
2 A1 a# p4 w1 r$ A3 {
蝯:
1 h) O# F. @! { p6 n$ j祉餃亦嚗閰W撣唾頝撖蝣潦撠 Client 蝡舐祇啣 Server蝡 甈桀,撠勗臭誑湔亦餃乩典董撖蝣潔,臭臬嫣噶,銝蝬SSH撖唾撓游具
! `' _+ \( O3 @孵亥牧:銝Y甇仿芣靘Client蝡舐雿輻刻user1撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻user1;憒Client蝡舐雿輻刻user1甈脣撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻root閰,甇仿<2>user1root,袖erver蝡舫隞叵oot餃,嗡雿賭璅
! s/ e( ?5 o9 B$ S, N; h! M7 P( M. m# |! X" m ?7 } P! |- n! u" ?. T8 }
! h9 f% Z8 O! t+ {& U$ G& ]& D
P.S 單澆Windows 撖蝣廣sh(Secure shell)追inux server,隢 http://blog.itist.tw/2015/03/login-ssh-server-without-username-and-password.html
0 {' }+ }) E/ o" P) q3 R' s
6 e) E' Y0 ^0 O5 t7 t! t8 W3 N |
|