砍敺 IT_man 2018-9-13 18:28 蝺刻摩 5 @; c `/ M# G5 @6 V$ ?
4 W4 x# i: D5 @6 m, I, [祉銝餉隞蝝孵linux client 撣唾撖蝣廣sh(Secure shell)追inux server銋閰喟敦蝔甇仿:
) E8 j- C! j- Z
( s& A& |1 Z; I% N: M7 }<1> 每lient蝡舐YClient: p" d e2 d/ h, H4 r) U n' U
1 E) n4 s# z, U! c, q, Q/ I" t
閮剖牢lient蝡臭誑雿輻刻 user1 餃,摰嗥桅 .ssh 桅鋆∴桀芣銝 known_hosts 瑼獢嚗舐其閮曄蝺啣亙啁server SSH Server 祇啜
, Q4 T) I. l& C3 y i% I/ X' S5 Q靘,Y銝蝯軏lient SSH 祇+蝘堆閮剜臭蝙 RSA 瞍蝞瘜 ==> ssh-keygen 隞 : ]% J/ E; N" ^/ }8 V9 Z
6 r: F5 W- m& y3 \8 M0 ^8 j
/ F$ [! } W+ }: D7 p
$ K( X8 @! m6 E* M. T$ s
, w! P; D: f8 m% l q- D& z) E
蝔銝賊閬雿輻刻閮剖,銝敹靽格,券函湔交 Enter 券閮剖澆停憟賭
" V N) l; v! D- r( |) E1. Enter file in which to save the key - 頛詨仿啁瑼獢頝臬蝔梧閮剜 ~/.ssh/id_rsa+ M: U7 _2 ]7 L! A9 E$ R
2. Enter passphrase - 頛詨亥芾撖蝣潦
1 A/ t( c9 @* ]# e8 L( \3. Enter same passphrase again - 頛詨乩甈∟芾撖蝣潦
! ^, j+ {* K0 ^( y; K8 E7 Q5 T& D- q' I
甇斗摰撠望Y id_rsa 蝘啣 id_rsa.pub 祇啜祇啁批捆嚗嗅祕撠勗芣臭撖摮撌脯5 @5 f) p; j9 Z# d, z j
雿輻 scp ftp 雿蝧瑼獢唾撓撌亙瑕 Client 蝡舐祇 ~/.ssh/id_rsa.pub 銴鋆賢 Server蝡航ㄐ,撣唾閮凋真ser1,暻澆停祇啣 user1 摰嗥桅 ~ 6 J4 l/ @/ w( Z' g; W8 G# F2 e# E9 X
; A4 L; U6 x! v6 \<2> Server蝡臬亙Client蝡舐Y祇:+ y& t7 k# l2 g! J3 T3 W
- B# @5 i$ m/ o% v! a/ @
沒SH頠擃,閮凋誑Putty Server蝡,user1餃亙蝣箄銝銝 Client 祇 id_rsa.pub 撌脩鋡怨鋆賡脖,憒摰嗥桅瘝 .ssh 桅撠梯芾撱箇, L! k! e6 U& `+ f, I5 ]9 k
.ssh 桅甈寞芣砌犖航撖,璅瘥頛摰具" [, Y. ^/ U, g& `: ^! r" Q5 |; {
chmod 700 ~/.ssh
8 `- V5 \8 k3 M銴鋆賡靘 Client 蝡臬祇堆臬亙 Server蝡舐甈皜(authorized_keys)鋆∼ $ A6 d; q1 _& Q9 Y
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
* T. T+ M7 N; _- g9 u, U/ |" p
璅 authorized_keys 瑼獢甈芣砌犖航撖,璅瘥頛摰具
9 @3 y3 j9 M @2 u4 \% h9 Z9 v3 Wchmod 600 ~/.ssh/authorized_keys, j. @3 v; K, N
; G6 \+ r9 u: D7 {2 F# F( T; j, s6 U% `9 _! G. S
4 v' L" A' @6 m- ]: D% ^蝯:
! ]0 B1 z% [1 e0 d; o祉餃亦嚗閰W撣唾頝撖蝣潦撠 Client 蝡舐祇啣 Server蝡 甈桀,撠勗臭誑湔亦餃乩典董撖蝣潔,臭臬嫣噶,銝蝬SSH撖唾撓游具
B# t- g2 I3 R) a孵亥牧:銝Y甇仿芣靘Client蝡舐雿輻刻user1撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻user1;憒Client蝡舐雿輻刻user1甈脣撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻root閰,甇仿<2>user1root,袖erver蝡舫隞叵oot餃,嗡雿賭璅
7 d0 ?' |3 Q, d& N- e% @6 |; F7 y, V: _0 B! D) g
( {+ d( k! H8 K- ]2 X4 u1 dP.S 單澆Windows 撖蝣廣sh(Secure shell)追inux server,隢 http://blog.itist.tw/2015/03/login-ssh-server-without-username-and-password.html
, y5 K: t# V8 c: Y0 I$ y# }/ [& t' a1 f$ [, M
|
|