砍敺 IT_man 2018-9-13 18:28 蝺刻摩
% E. @# Y3 ]# h* s* ?9 {- A- i& Q. I/ h. S! A1 e
祉銝餉隞蝝孵linux client 撣唾撖蝣廣sh(Secure shell)追inux server銋閰喟敦蝔甇仿:0 J! v( J8 W) x) T o) v
* l$ |& ^" h) i, A- Y7 N
<1> 每lient蝡舐YClient:
: O7 S: |% m. z) g) P. G9 Q
6 e5 H: m: `3 O$ R7 b0 W- L閮剖牢lient蝡臭誑雿輻刻 user1 餃,摰嗥桅 .ssh 桅鋆∴桀芣銝 known_hosts 瑼獢嚗舐其閮曄蝺啣亙啁server SSH Server 祇啜 T, g6 C% @/ j( {
靘,Y銝蝯軏lient SSH 祇+蝘堆閮剜臭蝙 RSA 瞍蝞瘜 ==> ssh-keygen 隞 :, S. ^( R9 j$ h" `/ R1 K8 U
2 P- `; z5 d) P0 q6 M8 r
6 q+ |6 ?4 Q w/ L# N6 D
6 [/ X/ Z) u: M v7 P) C6 U# }8 _ ^0 ^+ w0 n" r( L' {4 i/ F4 T
蝔銝賊閬雿輻刻閮剖,銝敹靽格,券函湔交 Enter 券閮剖澆停憟賭* W4 y/ `8 g$ ?; h" U; w: F
1. Enter file in which to save the key - 頛詨仿啁瑼獢頝臬蝔梧閮剜 ~/.ssh/id_rsa
2 \* @; s* W$ I1 a* U2 U& K. T2. Enter passphrase - 頛詨亥芾撖蝣潦8 s: ~% |1 f/ u; F1 y7 H5 X
3. Enter same passphrase again - 頛詨乩甈∟芾撖蝣潦
4 Q% V4 _+ c( o S, h/ N5 y. y! N, h2 P
甇斗摰撠望Y id_rsa 蝘啣 id_rsa.pub 祇啜祇啁批捆嚗嗅祕撠勗芣臭撖摮撌脯
& y+ ?- W: r1 O/ s+ _2 ^' L雿輻 scp ftp 雿蝧瑼獢唾撓撌亙瑕 Client 蝡舐祇 ~/.ssh/id_rsa.pub 銴鋆賢 Server蝡航ㄐ,撣唾閮凋真ser1,暻澆停祇啣 user1 摰嗥桅 ~
1 T) P) n7 n: ]+ x- ]
, A% o& y- X" e- P1 T3 f [<2> Server蝡臬亙Client蝡舐Y祇:
+ o9 T. Y" ?$ R0 f v) F" N3 M }- o: u/ W! P8 ]8 ~" q1 I1 w" `
沒SH頠擃,閮凋誑Putty Server蝡,user1餃亙蝣箄銝銝 Client 祇 id_rsa.pub 撌脩鋡怨鋆賡脖,憒摰嗥桅瘝 .ssh 桅撠梯芾撱箇1 Q D: G2 S9 ~" F) b/ k7 W, f+ Y
.ssh 桅甈寞芣砌犖航撖,璅瘥頛摰具0 X7 J5 C7 V: E
chmod 700 ~/.ssh
$ E) V( Q4 G5 C: w& `& w銴鋆賡靘 Client 蝡臬祇堆臬亙 Server蝡舐甈皜(authorized_keys)鋆∼
% I! c: S* d, H S# d+ P2 t7 i& icat ~/id_rsa.pub >> ~/.ssh/authorized_keys
" D! K0 p3 k: c2 ]% w# X5 }$ }! l* P% J& N9 A
璅 authorized_keys 瑼獢甈芣砌犖航撖,璅瘥頛摰具7 H+ ?3 J5 ]9 C! {
chmod 600 ~/.ssh/authorized_keys! V+ s, T( }9 e( O! g
( E0 C: v0 q0 a$ j$ w9 [) C& h9 M" |1 R3 j" x
) \5 s/ a9 s3 P5 Z# m" @蝯:: ~! m/ v) n' R' y
祉餃亦嚗閰W撣唾頝撖蝣潦撠 Client 蝡舐祇啣 Server蝡 甈桀,撠勗臭誑湔亦餃乩典董撖蝣潔,臭臬嫣噶,銝蝬SSH撖唾撓游具
& b W' j; V; a- l孵亥牧:銝Y甇仿芣靘Client蝡舐雿輻刻user1撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻user1;憒Client蝡舐雿輻刻user1甈脣撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻root閰,甇仿<2>user1root,袖erver蝡舫隞叵oot餃,嗡雿賭璅" Z$ t# r. M! ^6 H# _; U+ g, ^
9 O# s- c& B& O" Q! \
& U1 D& K$ s2 w, X" }P.S 單澆Windows 撖蝣廣sh(Secure shell)追inux server,隢 http://blog.itist.tw/2015/03/login-ssh-server-without-username-and-password.html
3 Q5 C7 A0 i) c) d. A0 @7 y# i7 a, g# I& B0 A+ a# T) H. @
|
|