砍敺 IT_man 2018-9-13 18:28 蝺刻摩
1 O) d: |3 M+ Q/ K! Q9 K! ^& P9 C8 i/ F* `0 }- z y
祉銝餉隞蝝孵linux client 撣唾撖蝣廣sh(Secure shell)追inux server銋閰喟敦蝔甇仿:% ~* J# y9 f+ A, [% c4 j. a" t
& n/ g; |/ O6 c2 b0 D
<1> 每lient蝡舐YClient:/ D4 Z7 O: ~$ u4 T. d) B
1 l1 r- N7 t( ]8 A5 d5 P
閮剖牢lient蝡臭誑雿輻刻 user1 餃,摰嗥桅 .ssh 桅鋆∴桀芣銝 known_hosts 瑼獢嚗舐其閮曄蝺啣亙啁server SSH Server 祇啜8 f; u. e/ E( B" p) z( o h7 c. U# v
靘,Y銝蝯軏lient SSH 祇+蝘堆閮剜臭蝙 RSA 瞍蝞瘜 ==> ssh-keygen 隞 :# Y. I1 B: U: }8 `6 S* ~6 X
1 d) d3 k4 T, @0 `$ p
8 }/ f* H! v# g+ h0 y! m
4 j/ C3 x3 P4 m
* U% b2 f) S* X! \4 b
蝔銝賊閬雿輻刻閮剖,銝敹靽格,券函湔交 Enter 券閮剖澆停憟賭
% t& Y) c" v+ [# N, E1. Enter file in which to save the key - 頛詨仿啁瑼獢頝臬蝔梧閮剜 ~/.ssh/id_rsa5 T, B3 _5 V; k
2. Enter passphrase - 頛詨亥芾撖蝣潦/ i) \" F1 m) X$ x( u
3. Enter same passphrase again - 頛詨乩甈∟芾撖蝣潦7 h: d! m0 A9 ]6 K8 n* T
4 D4 j3 p1 }! P) |甇斗摰撠望Y id_rsa 蝘啣 id_rsa.pub 祇啜祇啁批捆嚗嗅祕撠勗芣臭撖摮撌脯
9 g7 a |9 @( m/ \2 z9 Y; Z雿輻 scp ftp 雿蝧瑼獢唾撓撌亙瑕 Client 蝡舐祇 ~/.ssh/id_rsa.pub 銴鋆賢 Server蝡航ㄐ,撣唾閮凋真ser1,暻澆停祇啣 user1 摰嗥桅 ~
" [1 Z# `& B- o
& C+ y1 U) w2 K R' X<2> Server蝡臬亙Client蝡舐Y祇:
% F) n2 R$ X3 Y0 G" D# _9 Y
4 p6 t1 a0 {+ k/ A: P8 @沒SH頠擃,閮凋誑Putty Server蝡,user1餃亙蝣箄銝銝 Client 祇 id_rsa.pub 撌脩鋡怨鋆賡脖,憒摰嗥桅瘝 .ssh 桅撠梯芾撱箇
4 W# C7 m. ^ \# ?/ a; A .ssh 桅甈寞芣砌犖航撖,璅瘥頛摰具
; ~3 `4 k) o( H6 ]chmod 700 ~/.ssh
) z( N0 y: [$ o7 W銴鋆賡靘 Client 蝡臬祇堆臬亙 Server蝡舐甈皜(authorized_keys)鋆∼ ! e; v4 P4 O& X5 i0 A1 f7 U
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys9 ~' V/ f% S" V9 `
. q, v/ k/ Q+ z5 G璅 authorized_keys 瑼獢甈芣砌犖航撖,璅瘥頛摰具
- d+ a- P8 _" s- Echmod 600 ~/.ssh/authorized_keys# \9 u; t7 t/ ?; E5 g
" `5 o8 f7 h, C# [' ?
0 t) p5 b* l6 P' N
, o( \( a( J) A; E v. P4 S% ~蝯:- \, M |, Y4 H5 i: X
祉餃亦嚗閰W撣唾頝撖蝣潦撠 Client 蝡舐祇啣 Server蝡 甈桀,撠勗臭誑湔亦餃乩典董撖蝣潔,臭臬嫣噶,銝蝬SSH撖唾撓游具
4 R+ k: B3 ?7 y+ ^$ z孵亥牧:銝Y甇仿芣靘Client蝡舐雿輻刻user1撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻user1;憒Client蝡舐雿輻刻user1甈脣撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻root閰,甇仿<2>user1root,袖erver蝡舫隞叵oot餃,嗡雿賭璅) x6 G7 K2 x. T/ b. D- u
% e' }+ [2 Y7 P$ C5 {( u6 V. n& Q( z1 [0 [* p' h) `
P.S 單澆Windows 撖蝣廣sh(Secure shell)追inux server,隢 http://blog.itist.tw/2015/03/login-ssh-server-without-username-and-password.html& e- m! \( C Q
$ j8 [9 s5 D- ~7 Z. K
|
|