砍敺 IT_man 2018-9-13 18:28 蝺刻摩 4 ?6 L4 i- U9 i# B# s
+ g- y# W, b! O) C$ `祉銝餉隞蝝孵linux client 撣唾撖蝣廣sh(Secure shell)追inux server銋閰喟敦蝔甇仿:1 z( u$ `) z2 n5 K+ a% M: v; x
+ h4 ] D. i6 s" a$ Z6 Y
<1> 每lient蝡舐YClient:/ u6 H Q- \- g+ h- `% f
- H4 i7 Z. a, c* c* z
閮剖牢lient蝡臭誑雿輻刻 user1 餃,摰嗥桅 .ssh 桅鋆∴桀芣銝 known_hosts 瑼獢嚗舐其閮曄蝺啣亙啁server SSH Server 祇啜
9 D0 T0 M. H! I0 D: N靘,Y銝蝯軏lient SSH 祇+蝘堆閮剜臭蝙 RSA 瞍蝞瘜 ==> ssh-keygen 隞 :
9 }" Z% U6 g) D- V9 o. K0 H; t3 ?9 F8 ^9 V: @# a
' R2 c% T: E& b' r( \ n0 M# f+ D: t( X$ I% D/ p2 d( x7 M8 s
' A2 x7 y8 Y! [
蝔銝賊閬雿輻刻閮剖,銝敹靽格,券函湔交 Enter 券閮剖澆停憟賭
9 S* ?) v4 W0 z, q! L1. Enter file in which to save the key - 頛詨仿啁瑼獢頝臬蝔梧閮剜 ~/.ssh/id_rsa
& ?0 Y5 H" @8 V# |2. Enter passphrase - 頛詨亥芾撖蝣潦6 N" ~$ L% i& o: @* @" i
3. Enter same passphrase again - 頛詨乩甈∟芾撖蝣潦: o" \# Q/ ^! x9 g& S" g
. Z* {4 p# z$ ~3 j& l. k
甇斗摰撠望Y id_rsa 蝘啣 id_rsa.pub 祇啜祇啁批捆嚗嗅祕撠勗芣臭撖摮撌脯/ B* `# w% a5 S
雿輻 scp ftp 雿蝧瑼獢唾撓撌亙瑕 Client 蝡舐祇 ~/.ssh/id_rsa.pub 銴鋆賢 Server蝡航ㄐ,撣唾閮凋真ser1,暻澆停祇啣 user1 摰嗥桅 ~
) g! ~$ W7 {7 q8 `& c5 n
+ Z' |2 W4 N! g( }<2> Server蝡臬亙Client蝡舐Y祇:
' b" G# }- j# f" N- o$ D
8 Y$ m% o* ?0 L2 w( x沒SH頠擃,閮凋誑Putty Server蝡,user1餃亙蝣箄銝銝 Client 祇 id_rsa.pub 撌脩鋡怨鋆賡脖,憒摰嗥桅瘝 .ssh 桅撠梯芾撱箇! ^; A$ }9 m" @# f& w! D6 s
.ssh 桅甈寞芣砌犖航撖,璅瘥頛摰具
I J A3 R, g/ j: z% I% W6 mchmod 700 ~/.ssh" k' u2 g2 J1 J7 P. b$ J) B
銴鋆賡靘 Client 蝡臬祇堆臬亙 Server蝡舐甈皜(authorized_keys)鋆∼
9 _6 J6 O: d2 |' h: z7 ocat ~/id_rsa.pub >> ~/.ssh/authorized_keys
, x3 u8 y9 \0 t
* j% D4 i9 ~% ^" S I; Y璅 authorized_keys 瑼獢甈芣砌犖航撖,璅瘥頛摰具 i5 t1 G/ ?: }. a& V9 v9 Z( E' N/ W8 b
chmod 600 ~/.ssh/authorized_keys. E6 m# Q2 T4 \0 a* w' b5 Y, |: ?
. U' s# ]) |7 {+ @
- o3 d# x- q, c& W& g
/ i% C3 s+ L1 m% m6 S
蝯:
8 Q, I9 t- b, ? V( b祉餃亦嚗閰W撣唾頝撖蝣潦撠 Client 蝡舐祇啣 Server蝡 甈桀,撠勗臭誑湔亦餃乩典董撖蝣潔,臭臬嫣噶,銝蝬SSH撖唾撓游具
+ @0 W6 |9 @2 R$ z孵亥牧:銝Y甇仿芣靘Client蝡舐雿輻刻user1撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻user1;憒Client蝡舐雿輻刻user1甈脣撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻root閰,甇仿<2>user1root,袖erver蝡舫隞叵oot餃,嗡雿賭璅! t5 ]8 ]6 h5 a+ m1 V( e4 U
$ x2 {% H# z# Y" v' z' l: N
) g* q% y- ~$ s5 r# v v/ aP.S 單澆Windows 撖蝣廣sh(Secure shell)追inux server,隢 http://blog.itist.tw/2015/03/login-ssh-server-without-username-and-password.html% J4 V% B) j' j; a" }3 {
7 V2 \2 M+ i4 S0 v2 B' Q& S: X5 `
|
|