52AV璈A|52AV.ONE

 曉撖蝣
 蝡唾酉
敹急瑕
  • av隢憯BBS
  • 璈A
  • 芣瑟憭瘚
  • 鞎澆
  • 52av鋆貉摰
  • 銝剜-銝剖銝餅
     
亦: 3536|敺: 0
銝銝銝駁 銝銝銝駁

[linux隞也 Linux 銝 su v.s sudo 隞斗頛

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2014-12-21 14:08:00 | 芰閰脖 撣 |摨閬 |梯璅∪
砍敺 media 2014-12-21 14:12 蝺刻摩 ; I! n  h/ A% j! V  t
% o8 b+ |# g- `4 c* g1 f! W
su=switch user ,頧郢oot 撣唾
) E2 d% X. F, \6 b5 E2 gsudo 臭誑root甈瑁賊賭誘,靘憒: sudo service mysqld restart,抵隤芣憒銝:) S( I2 d) v6 }6 Y! V

- ]& O3 }8 ]; O8 `( d, b
Linux摰鋆憟隞嗉蝟餌絞閮剖賡閬root甈嚗撠望盎uper-user privileges (擃甈)嚗銋撠望舐恣⊥憒雿root甈嚗臭誑湔亦究sh餃叵oot撣唾嚗究u(substitute user)隞支雿輻刻嚗銝嗅停臭蝙究udo隞扎 # h7 j# |. [" l$ }7 S3 t* z$ d' g
9 U! v6 b) p8 Z! e" ^/ |& d: V
1. 雿輻究u隞
  1. #究u雿輻刻
    ' p, _  b2 o* w
  2. [aaron@phoenix ~]$ su#雿輻究u氳oot2 O9 M# \/ G: x. R0 P) U
  3. Password:[頛詨叵oot撖蝣奭
    , H2 k& a9 V. j" {- `7 @5 X2 m9 I
  4. $ P8 x; T7 T5 M; E$ f
  5. [root@phoenix aaron]# service httpd restart#撌脣氳oot5 H" L7 ^& C# L2 K& `2 ~  ~
  6. Stopping httpd:                                            [  OK  ]) W/ m/ g, o* J- b  ]# P: v
  7. Starting httpd:                                            [  OK  ]4 L0 f2 n" v+ |9 T+ `

  8. ; @8 m* }9 W" r4 D. G5 }
  9. [root@phoenix aaron]# exit#aaron2 D$ _* s% o! }( W+ V0 B5 M3 Q1 W
  10. " \7 k" c& C1 |0 J2 t
  11. #瑁桐隞歹銝閬氳oot' x5 S: }- L/ t, F* i
  12. [aaron@phoenix ~]$ su -c "service httpd restart"# [, ?" u8 i+ ~0 f
  13. Password:[頛詨叵oot撖蝣奭
    , [8 }* o+ B! z) Y7 {
  14. Stopping httpd:                                            [  OK  ]1 b; e0 ?, Z( W
  15. Starting httpd:                                            [  OK  ]
    0 l1 R. P7 f5 O) ~

  16. 8 i, Z+ ~5 |+ n! }0 ^
  17. #瑁susu -撌桀(Shell啣臬西)5 @5 J) T7 H8 p  U. d6 r
  18. [aaron@phoenix ~]$ su& J- e4 J9 W. q1 B
  19. Password:[頛詨叵oot撖蝣奭: y7 S% n9 I% p6 i! z: r
  20. [root@phoenix aaron]# echo $PATH#訐ATH霈賂潛暸雿輻災aronPATH霈5 y8 D: _' U+ T6 {7 F
  21. /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/aaron/bin/ L3 r- Z. \+ n

  22. 0 \) J+ a+ ~2 `7 S' w. a2 D
  23. [aaron@phoenix ~]$ su -+ `: q7 n: n/ W0 K" z
  24. Password:[頛詨叵oot撖蝣奭
    ! m8 i/ \8 c7 v' t+ O! H
  25. [root@phoenix aaron]# echo $PATH#訐ATH霈賂雿輻禿ootPATH霈6 l6 t; J. t5 M+ W& H
  26. /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
銴鋆賭誨蝣

! j; n. o, l  t8 E; ]/ b* o1 Y2. 閮剖sudoer
8 s$ p: C' Y, |, n. l0 C7 V8 S- E) A
  1. [aaron@phoenix ~]$ su
    ( f: o1 u8 j4 ~* }
  2. Password:[頛詨叵oot撖蝣奭$ H5 e) C$ i# m9 `& v

  3. # N/ ~) P; @+ R, M, p
  4. [root@phoenix aaron]# vim /etc/sudoers
    / x1 e  F/ x. S& j

  5. 7 s7 N2 k! b. w3 ~& e
  6. ## Allow root to run any commands anywhere
    * T  F1 O% |/ T8 n/ m" R! _( `
  7. root    ALL=(ALL)       ALL
    * V  d0 N6 X) T% @

  8. ! m& r1 s. S0 O& |
  9. ## Allow users to run any commands anywhere) e+ O: v) I) e. N# M8 h
  10. aaron   ALL=(ALL)       ALL#啣璇閮帶aron臭誑瑁蝞∠⊥
銴鋆賭誨蝣

7 M# b5 _0 ?0 M1 I% H; E" w3. 蝭靘
  1. #瘝擃甈嚗隞亙停鋡急鈭
    # }. E4 C7 G5 j' X; ?8 V
  2. [aaron@phoenix ~]$ service httpd restart. n8 e1 E7 ?2 w8 x( [' Z
  3. Stopping httpd:4 Y4 v, h6 i9 T. P5 Q% L# R
  4. rm: cannot remove `/var/run/httpd/httpd.pid': Permission denied
    " c8 E  G1 G; j

  5. 7 v: q# f. s: x
  6. Starting httpd:
    1 z% P( z' }/ Z8 d. I7 V: j" s
  7. touch: cannot touch `/var/lock/subsys/httpd': Permission denied
    + ?& N# h- X0 }2 g+ t# j* C
  8. $ m6 p; l: [0 J5 y8 f' f
  9. #究udo撠勗臭誑
    - |  @% A8 s3 \8 o* t7 k  L
  10. [aaron@phoenix ~]$ sudo service httpd restart
    6 T- `! w6 ]/ \! g4 @
  11. [sudo] password for aaron:[頛詨亙蝣奭
    & K9 t; C3 K' K" H1 P: Y9 L# J: I! O
  12. Stopping httpd:                                            [  OK  ]7 T4 D  n% h4 }1 S" f; N2 k
  13. Starting httpd:                                            [  OK  ]
銴鋆賭誨蝣
#susudo撌桀亙冽潭臬西霈銝砌蝙刻仿root撖蝣潘憒究u撠勗撠root撖蝣澆鈭怠箏鳴敺航賡蝟餌絞鋡思噩亦梢芥sudo航銝砌蝙刻蝞∠⊥嚗芾頛詨亥芸楛撖蝣澆喳荔雿璅憸券迎箸蝞∠⊥1 D. F# j4 g9 Z. _( O9 |: |7 g& w
http://kezeodsnx.pixnet.net/blog/post/25810396

雿輻券

祉蝛閬

BT蝳

砍憛批捆靘餉衣雯頝臬批捆蝝颲行粹嗥蝬脩嚗摰撟湔遛嚗嚗甇脖誑銝嗅啣摰嗆摰撟湧翩鈭箏ㄚ孵舫脣伐銝憿亙祉璇甈橘芣遛18甇 雓蝯脣亦閬賬粹脩芣遛18甇脖芣撟渡雯閬賜雯頝臭嗥批捆鞈閮嚗撱箄降典舫脰蝬脰楝批捆蝝蝯蝜ICRA蝝摰鋆閮剖 (粹蝯行霅 祉蝬脣銝蝝瘛函隢憯啣嚗祉閮剜蝞∠)

QQ|撠暺撅||52AV璈A

GMT+8, 2024-12-26 15:59 , Processed in 0.070387 second(s), 16 queries .

蝯∠.撱

[email protected] | QQ:2405733034     since 2015-01

鋆貉憒 敹恍敺 餈銵