砍敺 IT_man 2018-9-13 18:28 蝺刻摩 1 G8 b! j% j$ P* b! Z3 E
6 G7 D. h7 x# h0 s& U; r祉銝餉隞蝝孵linux client 撣唾撖蝣廣sh(Secure shell)追inux server銋閰喟敦蝔甇仿:
( X, X6 W& H/ f4 f
' q( W0 m" O! X2 B<1> 每lient蝡舐YClient:& B+ O: ~0 _; m- n( m# b0 m. l
$ z$ d* A( {0 c G8 M閮剖牢lient蝡臭誑雿輻刻 user1 餃,摰嗥桅 .ssh 桅鋆∴桀芣銝 known_hosts 瑼獢嚗舐其閮曄蝺啣亙啁server SSH Server 祇啜% G Z* n. `9 _+ Z' Y7 D
靘,Y銝蝯軏lient SSH 祇+蝘堆閮剜臭蝙 RSA 瞍蝞瘜 ==> ssh-keygen 隞 :# z9 m8 _$ }8 O1 r5 q! P: c
, e% M7 _# X" W* i7 Z
1 y6 s( Z2 e& w$ d, `- W
: r- L3 g$ u* G; G
2 E |% a4 Y4 [蝔銝賊閬雿輻刻閮剖,銝敹靽格,券函湔交 Enter 券閮剖澆停憟賭
6 o4 m9 ]' Z6 m: C1. Enter file in which to save the key - 頛詨仿啁瑼獢頝臬蝔梧閮剜 ~/.ssh/id_rsa
1 G. T& M4 w* b- B q2 t2. Enter passphrase - 頛詨亥芾撖蝣潦3 x7 o) L$ K6 O+ N, b! w
3. Enter same passphrase again - 頛詨乩甈∟芾撖蝣潦
! P7 r. g. }. w1 i& [! l `- g9 ^# q/ w0 q" W
甇斗摰撠望Y id_rsa 蝘啣 id_rsa.pub 祇啜祇啁批捆嚗嗅祕撠勗芣臭撖摮撌脯
7 k( L% d/ p, A( ~/ [) j& G雿輻 scp ftp 雿蝧瑼獢唾撓撌亙瑕 Client 蝡舐祇 ~/.ssh/id_rsa.pub 銴鋆賢 Server蝡航ㄐ,撣唾閮凋真ser1,暻澆停祇啣 user1 摰嗥桅 ~
0 t4 e, L6 ~) ^; @: L" \: A a' r2 m# M! `$ k# O2 U4 _2 A
<2> Server蝡臬亙Client蝡舐Y祇:
$ ?( V( S v& L4 a: m5 \8 S# H# s
$ b* T( f4 d, z! X- b* K9 e6 s$ X沒SH頠擃,閮凋誑Putty Server蝡,user1餃亙蝣箄銝銝 Client 祇 id_rsa.pub 撌脩鋡怨鋆賡脖,憒摰嗥桅瘝 .ssh 桅撠梯芾撱箇( q; R- l( |; r8 @, f" X! x( D0 N
.ssh 桅甈寞芣砌犖航撖,璅瘥頛摰具 H2 B0 p8 M% g+ N. d$ p
chmod 700 ~/.ssh
5 Y6 U' P, n9 D銴鋆賡靘 Client 蝡臬祇堆臬亙 Server蝡舐甈皜(authorized_keys)鋆∼ ; X! A+ Y' b$ _( N$ X
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
- |1 j0 s6 u0 H. A
0 u5 E4 E2 y. c/ z璅 authorized_keys 瑼獢甈芣砌犖航撖,璅瘥頛摰具) @ G% M, y p2 O- B# l" h4 H
chmod 600 ~/.ssh/authorized_keys
; N: j" m2 q: F6 t) d7 H2 }5 Y, y# b& {9 M
, v4 X7 D. d" P, ?) }
# |' K' t) E# h. P蝯:9 }+ `5 }; k; b
祉餃亦嚗閰W撣唾頝撖蝣潦撠 Client 蝡舐祇啣 Server蝡 甈桀,撠勗臭誑湔亦餃乩典董撖蝣潔,臭臬嫣噶,銝蝬SSH撖唾撓游具3 P9 U' [5 A1 y5 {% h% v
孵亥牧:銝Y甇仿芣靘Client蝡舐雿輻刻user1撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻user1;憒Client蝡舐雿輻刻user1甈脣撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻root閰,甇仿<2>user1root,袖erver蝡舫隞叵oot餃,嗡雿賭璅
- K- i- C5 a+ q8 j9 q
& S9 \3 d, ^5 Z# F. H* d$ `# v6 l% r v7 b6 _' h3 {# N; R+ e* ] ~
P.S 單澆Windows 撖蝣廣sh(Secure shell)追inux server,隢 http://blog.itist.tw/2015/03/login-ssh-server-without-username-and-password.html
: ?+ {$ m5 c9 w* v. ? v& h- D5 ~. w& s4 o5 J
|
|