砍敺 IT_man 2018-9-13 18:28 蝺刻摩
& ]/ [) N% j( ?6 N3 {1 b' K5 S+ ?; G
# f7 _0 r- Q: F( n* o祉銝餉隞蝝孵linux client 撣唾撖蝣廣sh(Secure shell)追inux server銋閰喟敦蝔甇仿: y! v# V2 S) ~! Y, P
/ H' z) a( {2 a1 X/ e; V& Q( P$ X: V
<1> 每lient蝡舐YClient:7 `; K0 |6 ` Q1 }
" m" }) N" p9 b" Z6 p$ [
閮剖牢lient蝡臭誑雿輻刻 user1 餃,摰嗥桅 .ssh 桅鋆∴桀芣銝 known_hosts 瑼獢嚗舐其閮曄蝺啣亙啁server SSH Server 祇啜
6 |% X# i% m- u7 `靘,Y銝蝯軏lient SSH 祇+蝘堆閮剜臭蝙 RSA 瞍蝞瘜 ==> ssh-keygen 隞 :- R0 A9 R: g: X* `( w/ j# E7 T
8 d: a( T1 C0 C% p& x
3 @6 g# ]9 A2 g7 p7 _" k5 Z8 F% C8 D0 x7 J$ P7 {
* [ @" o; r* {+ i Y$ E蝔銝賊閬雿輻刻閮剖,銝敹靽格,券函湔交 Enter 券閮剖澆停憟賭
w; @' O; a% @, ~1. Enter file in which to save the key - 頛詨仿啁瑼獢頝臬蝔梧閮剜 ~/.ssh/id_rsa2 t- F( Z5 j5 _
2. Enter passphrase - 頛詨亥芾撖蝣潦; F4 M2 v6 \9 p- R0 B+ @( E" I
3. Enter same passphrase again - 頛詨乩甈∟芾撖蝣潦
) E3 d' A1 n4 `& T; }" ~# q9 _3 r) }8 ~
甇斗摰撠望Y id_rsa 蝘啣 id_rsa.pub 祇啜祇啁批捆嚗嗅祕撠勗芣臭撖摮撌脯3 G6 e |6 p1 C' a! N6 u& @8 R! ~
雿輻 scp ftp 雿蝧瑼獢唾撓撌亙瑕 Client 蝡舐祇 ~/.ssh/id_rsa.pub 銴鋆賢 Server蝡航ㄐ,撣唾閮凋真ser1,暻澆停祇啣 user1 摰嗥桅 ~
2 A3 ^5 Y0 q5 ^9 D. M' Y5 A/ V/ q; a# [% z
<2> Server蝡臬亙Client蝡舐Y祇:. _( f/ q! q1 \/ c q r
" Y# n5 k9 s: L X* g7 F
沒SH頠擃,閮凋誑Putty Server蝡,user1餃亙蝣箄銝銝 Client 祇 id_rsa.pub 撌脩鋡怨鋆賡脖,憒摰嗥桅瘝 .ssh 桅撠梯芾撱箇
* A( M& u$ c% C .ssh 桅甈寞芣砌犖航撖,璅瘥頛摰具( j+ }8 U. h; w7 v. x4 Q
chmod 700 ~/.ssh. B5 o, s/ t B
銴鋆賡靘 Client 蝡臬祇堆臬亙 Server蝡舐甈皜(authorized_keys)鋆∼ ; ]8 ]! U3 r: R0 H6 T' L
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
$ ` q$ {* a" F
8 G' F0 Q0 k6 y* T0 g璅 authorized_keys 瑼獢甈芣砌犖航撖,璅瘥頛摰具
0 u& P, R* M& Hchmod 600 ~/.ssh/authorized_keys
1 J( T* i$ M0 v( f5 j, Y( ~! o$ x" f( d
% o' @/ J# \+ a6 X+ l
: u9 P) K7 k% ~7 X蝯:
- c/ X1 t4 ?0 Y2 T/ U祉餃亦嚗閰W撣唾頝撖蝣潦撠 Client 蝡舐祇啣 Server蝡 甈桀,撠勗臭誑湔亦餃乩典董撖蝣潔,臭臬嫣噶,銝蝬SSH撖唾撓游具, d/ n( A* C- s& l/ P/ L4 J
孵亥牧:銝Y甇仿芣靘Client蝡舐雿輻刻user1撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻user1;憒Client蝡舐雿輻刻user1甈脣撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻root閰,甇仿<2>user1root,袖erver蝡舫隞叵oot餃,嗡雿賭璅
' D9 s, J: G; q$ p1 ]+ C5 M! @: f0 S1 G `- j
+ O& |1 k4 V8 r p p
P.S 單澆Windows 撖蝣廣sh(Secure shell)追inux server,隢 http://blog.itist.tw/2015/03/login-ssh-server-without-username-and-password.html! H8 _4 ?; S8 Q& [+ O( W
! v6 c& ?, {1 t; X5 E
|
|