砍敺 IT_man 2018-9-13 18:28 蝺刻摩 5 w& r, ]$ I1 b0 @. B. e3 R
7 V$ g, E r$ m4 J! z8 A祉銝餉隞蝝孵linux client 撣唾撖蝣廣sh(Secure shell)追inux server銋閰喟敦蝔甇仿:
$ s/ Z v+ |, P( h- m! z$ Z! h. @9 |
<1> 每lient蝡舐YClient:& f P3 T- ?0 A! o
7 o# A# y# J( e% o1 J" h( G
閮剖牢lient蝡臭誑雿輻刻 user1 餃,摰嗥桅 .ssh 桅鋆∴桀芣銝 known_hosts 瑼獢嚗舐其閮曄蝺啣亙啁server SSH Server 祇啜2 f+ p, [( u4 }, ?- S& ]
靘,Y銝蝯軏lient SSH 祇+蝘堆閮剜臭蝙 RSA 瞍蝞瘜 ==> ssh-keygen 隞 :
6 [$ n3 o( Q& [0 E4 I: X( Y3 N. O* l* ~1 _# ]2 }
1 m9 W4 `% {/ O( Y/ y' E( g9 r4 G
& W/ g' r' ~! d# N, E9 @& r7 V
( r1 T+ Q4 F9 w; u8 R8 v0 L9 g B蝔銝賊閬雿輻刻閮剖,銝敹靽格,券函湔交 Enter 券閮剖澆停憟賭
& w9 N; o( e/ s) d$ D: v( I1. Enter file in which to save the key - 頛詨仿啁瑼獢頝臬蝔梧閮剜 ~/.ssh/id_rsa* m; k& D* [) r1 S! X; I
2. Enter passphrase - 頛詨亥芾撖蝣潦9 ?+ r, \; x/ G) {
3. Enter same passphrase again - 頛詨乩甈∟芾撖蝣潦
4 Y7 s! N- D, w2 e- j6 r$ M/ ~& @! G
甇斗摰撠望Y id_rsa 蝘啣 id_rsa.pub 祇啜祇啁批捆嚗嗅祕撠勗芣臭撖摮撌脯- p5 I( _ U! ?4 ?5 \
雿輻 scp ftp 雿蝧瑼獢唾撓撌亙瑕 Client 蝡舐祇 ~/.ssh/id_rsa.pub 銴鋆賢 Server蝡航ㄐ,撣唾閮凋真ser1,暻澆停祇啣 user1 摰嗥桅 ~
( [6 F8 h' [ n0 k+ p+ n6 F; r- w. X# V2 z/ [7 ?: s
<2> Server蝡臬亙Client蝡舐Y祇:8 y+ u r$ l0 @; s# C! ]* e
& z+ s, T# c, ^# B7 ]* [' ^沒SH頠擃,閮凋誑Putty Server蝡,user1餃亙蝣箄銝銝 Client 祇 id_rsa.pub 撌脩鋡怨鋆賡脖,憒摰嗥桅瘝 .ssh 桅撠梯芾撱箇
8 D0 g2 y# ]' y1 I .ssh 桅甈寞芣砌犖航撖,璅瘥頛摰具+ s/ B1 F$ z. A, b3 B* Q
chmod 700 ~/.ssh
" P7 b( q5 s5 U3 `& R2 r- t銴鋆賡靘 Client 蝡臬祇堆臬亙 Server蝡舐甈皜(authorized_keys)鋆∼ 5 D: F5 a+ }) {* c! i" r( m. t! Y' E
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys, n. ?. ^- `* T
8 [6 t) R7 {" W$ g, J璅 authorized_keys 瑼獢甈芣砌犖航撖,璅瘥頛摰具
; b1 e- r% L) J# Zchmod 600 ~/.ssh/authorized_keys
0 {6 ?' a) W6 ?" j) @! Q
* j% ?2 o. r9 D0 h# W3 x- f8 x( K5 A
- }/ {% B( R4 w. G% |! f蝯:& n! ?3 e/ _8 b' }6 n+ M% [
祉餃亦嚗閰W撣唾頝撖蝣潦撠 Client 蝡舐祇啣 Server蝡 甈桀,撠勗臭誑湔亦餃乩典董撖蝣潔,臭臬嫣噶,銝蝬SSH撖唾撓游具
c5 R1 d; f" G" K孵亥牧:銝Y甇仿芣靘Client蝡舐雿輻刻user1撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻user1;憒Client蝡舐雿輻刻user1甈脣撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻root閰,甇仿<2>user1root,袖erver蝡舫隞叵oot餃,嗡雿賭璅
7 E! k: ?4 q% d, C+ J; a6 R* V* q9 w" }" C _5 l
$ G! A! l9 t! I! ^P.S 單澆Windows 撖蝣廣sh(Secure shell)追inux server,隢 http://blog.itist.tw/2015/03/login-ssh-server-without-username-and-password.html. g3 i& f$ O" H+ f! \3 o3 d9 H+ j
3 z8 d1 a" x& o4 j+ v |
|