砍敺 IT_man 2018-9-13 18:28 蝺刻摩 ( p; D% @8 R- |( W' j
1 ]* j) l6 i$ D/ Q" W
祉銝餉隞蝝孵linux client 撣唾撖蝣廣sh(Secure shell)追inux server銋閰喟敦蝔甇仿:/ A2 I# o7 L9 w: u& v |/ z
1 |) H1 _4 c( r/ K v
<1> 每lient蝡舐YClient:
% h! _0 C/ Z" @$ o) A) M/ k# ?
9 ?7 }: u8 W: D& a" V* y) N7 a閮剖牢lient蝡臭誑雿輻刻 user1 餃,摰嗥桅 .ssh 桅鋆∴桀芣銝 known_hosts 瑼獢嚗舐其閮曄蝺啣亙啁server SSH Server 祇啜0 b, t# N5 j9 E% ]3 O' G5 u$ f% x
靘,Y銝蝯軏lient SSH 祇+蝘堆閮剜臭蝙 RSA 瞍蝞瘜 ==> ssh-keygen 隞 :: W1 R4 J3 e/ i- B0 u d6 V- K
+ k& I! E: J5 V0 N) \
E0 `/ ^: \+ _( ]& u* x) l' k; f: J. x5 D9 d
8 V. T% L q5 s. c. ~! N& g* i
蝔銝賊閬雿輻刻閮剖,銝敹靽格,券函湔交 Enter 券閮剖澆停憟賭
6 B7 z5 j$ V; Y8 Z1 R% ~1. Enter file in which to save the key - 頛詨仿啁瑼獢頝臬蝔梧閮剜 ~/.ssh/id_rsa* J W" q" Z+ U! c. i
2. Enter passphrase - 頛詨亥芾撖蝣潦! z3 d! B( p; b! N" Z
3. Enter same passphrase again - 頛詨乩甈∟芾撖蝣潦
8 t! N7 Y& D$ z2 C+ b6 o: w6 Q7 l5 v, B) p, K2 r# z1 o
甇斗摰撠望Y id_rsa 蝘啣 id_rsa.pub 祇啜祇啁批捆嚗嗅祕撠勗芣臭撖摮撌脯
/ W7 o' i8 |( S7 D! [雿輻 scp ftp 雿蝧瑼獢唾撓撌亙瑕 Client 蝡舐祇 ~/.ssh/id_rsa.pub 銴鋆賢 Server蝡航ㄐ,撣唾閮凋真ser1,暻澆停祇啣 user1 摰嗥桅 ~ + |+ S7 G- V C, u# p( ^1 x
Y: B+ I# V/ i( a- B
<2> Server蝡臬亙Client蝡舐Y祇:
2 Y ]$ @0 \8 Y
* n# o- }: S% q4 M. {% u8 E, [沒SH頠擃,閮凋誑Putty Server蝡,user1餃亙蝣箄銝銝 Client 祇 id_rsa.pub 撌脩鋡怨鋆賡脖,憒摰嗥桅瘝 .ssh 桅撠梯芾撱箇
. o1 e; s! O+ M& o2 m' q" }* ~( m .ssh 桅甈寞芣砌犖航撖,璅瘥頛摰具. Z `% B5 ~9 @$ ?
chmod 700 ~/.ssh
4 g ~2 E. H. W銴鋆賡靘 Client 蝡臬祇堆臬亙 Server蝡舐甈皜(authorized_keys)鋆∼ ! y1 d! @' w; e$ O5 P& R
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys. }* w" N; m r/ L* L. w; M
4 P, _ t) R2 @. F7 C- W璅 authorized_keys 瑼獢甈芣砌犖航撖,璅瘥頛摰具& G$ k# s" E( @0 m$ [4 y
chmod 600 ~/.ssh/authorized_keys1 b6 F% P- o5 _# D4 r( N6 s# S
- \" Z& Y: y. f8 Y1 a+ Q" e _( o! m a: t+ H3 E0 }* Z
1 U& Z9 |: h/ J/ t/ f) M
蝯:
' Z' [+ ^$ f/ m4 l5 v祉餃亦嚗閰W撣唾頝撖蝣潦撠 Client 蝡舐祇啣 Server蝡 甈桀,撠勗臭誑湔亦餃乩典董撖蝣潔,臭臬嫣噶,銝蝬SSH撖唾撓游具
7 ~! E1 Q1 A9 T, M7 ? l4 W' ~孵亥牧:銝Y甇仿芣靘Client蝡舐雿輻刻user1撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻user1;憒Client蝡舐雿輻刻user1甈脣撣唾撖蝣潛餃亙訕erver蝡舐雿輻刻root閰,甇仿<2>user1root,袖erver蝡舫隞叵oot餃,嗡雿賭璅
: ^# x! c W* h h( t. `# R# U2 n+ G( Q
* J9 H% S8 z8 w W! O
P.S 單澆Windows 撖蝣廣sh(Secure shell)追inux server,隢 http://blog.itist.tw/2015/03/login-ssh-server-without-username-and-password.html
7 d9 x4 w& y5 K9 e5 g( b. H* M& ^% O3 Q
|
|