砍敺 IT_man 2018-9-13 18:28 蝺刻摩 8 @( o6 [. m- m+ i
0 q4 ?7 c: \! t+ c4 l祉銝餉隞蝝孵linux client 撣唾撖蝣廣sh(Secure shell)追inux server銋閰喟敦蝔甇仿:" V: A# ~# j. d6 B, h0 h4 f' x; {0 u
2 b* ^: w8 b7 O- b
<1> 每lient蝡舐YClient:% R/ P$ k% y3 C+ N! v q
0 U3 P+ A' p: ~# H: Q閮剖牢lient蝡臭誑雿輻刻 user1 餃,摰嗥桅 .ssh 桅鋆∴桀芣銝 known_hosts 瑼獢嚗舐其閮曄蝺啣亙啁server SSH Server 祇啜
7 h: d% T5 O- E: J. X' ^' Z靘,Y銝蝯軏lient SSH 祇+蝘堆閮剜臭蝙 RSA 瞍蝞瘜 ==> ssh-keygen 隞 :+ W, P2 K$ _" d8 g* a
( d- _" V8 ]3 V3 k
: W) T" M8 c! I$ @* | q: {4 l Z7 E6 u5 n/ ~4 L
, |& \% H/ ?( J% V. Z蝔銝賊閬雿輻刻閮剖,銝敹靽格,券函湔交 Enter 券閮剖澆停憟賭
/ c8 j @) S* k8 P/ a0 b1. Enter file in which to save the key - 頛詨仿啁瑼獢頝臬蝔梧閮剜 ~/.ssh/id_rsa
+ f! G$ o3 [# n! T# e+ w% r, Y2. Enter passphrase - 頛詨亥芾撖蝣潦* b1 Y. N" ~ r8 C6 i3 }+ p# G* x
3. Enter same passphrase again - 頛詨乩甈∟芾撖蝣潦
; `$ P1 E# f( k5 K6 E" i" m; R) w; [! k; C+ c2 O/ x$ {* }
甇斗摰撠望Y id_rsa 蝘啣 id_rsa.pub 祇啜祇啁批捆嚗嗅祕撠勗芣臭撖摮撌脯
* |: F, e! {6 W4 u- g雿輻 scp ftp 雿蝧瑼獢唾撓撌亙瑕 Client 蝡舐祇 ~/.ssh/id_rsa.pub 銴鋆賢 Server蝡航ㄐ,撣唾閮凋真ser1,暻澆停祇啣 user1 摰嗥桅 ~ S, ^, A5 g8 A' L* u" i
5 S4 w6 w6 [" ]
<2> Server蝡臬亙Client蝡舐Y祇:
. V. C3 |9 \1 o! v% ~
* Y0 c6 Z) f$ i+ G# n沒SH頠擃,閮凋誑Putty Server蝡,user1餃亙蝣箄銝銝 Client 祇 id_rsa.pub 撌脩鋡怨鋆賡脖,憒摰嗥桅瘝 .ssh 桅撠梯芾撱箇
q7 y$ M% O2 g. \) C .ssh 桅甈寞芣砌犖航撖,璅瘥頛摰具
7 O' g$ C; Q1 P1 w& v( Bchmod 700 ~/.ssh: S3 a- P. J' f- J* y7 N
銴鋆賡靘 Client 蝡臬祇堆臬亙 Server蝡舐甈皜(authorized_keys)鋆∼
6 n7 I0 E7 h7 S$ ~; pcat ~/id_rsa.pub >> ~/.ssh/authorized_keys: D x5 K0 y6 s8 i5 _& r4 n' ~
1 C8 w5 u; d+ Q+ s r2 B璅 authorized_keys 瑼獢甈芣砌犖航撖,璅瘥頛摰具
h% P9 w& P; B& {$ A" Hchmod 600 ~/.ssh/authorized_keys8 Y$ J+ ?+ P7 k# P( p6 n
8 G' q- L: u" l! \% ~: y3 C( V
. W# K, z3 z! c3 R8 o" x% K! l; k* d
蝯:
- S* ?; U7 S" s* a% j9 f. X$ ~祉餃亦嚗閰W撣唾頝撖蝣潦撠 Client 蝡舐祇啣 Server蝡 甈桀,撠勗臭誑湔亦餃乩典董撖蝣潔,臭臬嫣噶,銝蝬SSH撖唾撓游具
3 W( @6 ~0 r. h6 s- v- D- q孵亥牧:銝Y甇仿芣靘Client蝡舐雿輻刻user1撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻user1;憒Client蝡舐雿輻刻user1甈脣撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻root閰,甇仿<2>user1root,袖erver蝡舫隞叵oot餃,嗡雿賭璅1 j7 `0 ]) a- c5 q4 V4 T: o
! l7 f4 y8 E2 J' B6 n3 T
0 f6 b7 v& P; Y% ]5 |8 j* F4 K5 ?P.S 單澆Windows 撖蝣廣sh(Secure shell)追inux server,隢 http://blog.itist.tw/2015/03/login-ssh-server-without-username-and-password.html( I; U: A6 j- @% m$ A
& {* `5 O& ~3 T0 ~1 M$ ~ |
|