52AV璈A|52AV.ONE

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

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

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2014-12-21 14:08:00 | 芰閰脖 撣 |甇摨閬 |梯璅∪
砍敺 media 2014-12-21 14:12 蝺刻摩
' e$ ?9 a9 f- s5 w  |) u/ S: B# R) [7 A1 v. t
su=switch user ,頧郢oot 撣唾
' }3 Y) i1 p5 R$ H% l( qsudo 臭誑root甈瑁賊賭誘,靘憒: sudo service mysqld restart,抵隤芣憒銝:
; J" o- p- _5 _0 R" _3 i
4 z2 R1 _, e. Q; R
Linux摰鋆憟隞嗉蝟餌絞閮剖賡閬root甈嚗撠望盎uper-user privileges (擃甈)嚗銋撠望舐恣⊥憒雿root甈嚗臭誑湔亦究sh餃叵oot撣唾嚗究u(substitute user)隞支雿輻刻嚗銝嗅停臭蝙究udo隞扎
6 a& Y% G1 X, H: [: Q9 R* S, R9 M. K9 A( b) Z
1. 雿輻究u隞
  1. #究u雿輻刻
    2 M7 n" f  L; b# H( F" z- Y! ~7 X; s
  2. [aaron@phoenix ~]$ su#雿輻究u氳oot; l+ ~' Y6 p5 ?
  3. Password:[頛詨叵oot撖蝣奭
    5 F+ n; y1 d4 C( t( o5 K
  4. $ F- P2 X2 ^8 o- Y
  5. [root@phoenix aaron]# service httpd restart#撌脣氳oot
    . J7 w# W+ U9 \2 H$ S
  6. Stopping httpd:                                            [  OK  ]4 \3 F# l6 ]# }5 H
  7. Starting httpd:                                            [  OK  ]4 c- }5 v% e6 V7 q" c; S; r! @
  8. $ U9 g+ V9 j5 @  t# x( E
  9. [root@phoenix aaron]# exit#aaron3 {' l; y0 B/ [7 H8 q) |3 c' ^( {

  10. . d6 x$ r8 b: Z1 G" A
  11. #瑁桐隞歹銝閬氳oot
    7 I( F$ l8 O3 P
  12. [aaron@phoenix ~]$ su -c "service httpd restart"
    7 ~$ U, D  V  L: S( s
  13. Password:[頛詨叵oot撖蝣奭8 {5 D' N0 q/ K! N
  14. Stopping httpd:                                            [  OK  ]6 P1 m' g. a8 l6 h4 Q- c' Q
  15. Starting httpd:                                            [  OK  ]
    0 y. ]7 @8 H* N: r9 l, I, i7 s

  16. , i7 \+ F& y- `6 v- m1 p8 i# [' G
  17. #瑁susu -撌桀(Shell啣臬西)7 y) C8 Y# _* x* b* }; c8 \5 g
  18. [aaron@phoenix ~]$ su
    ; `1 U. _" l9 T
  19. Password:[頛詨叵oot撖蝣奭
    6 z% Z/ P9 G. v  v1 {" M
  20. [root@phoenix aaron]# echo $PATH#訐ATH霈賂潛暸雿輻災aronPATH霈4 f+ L) V) W7 F0 P
  21. /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/aaron/bin+ p3 M  \8 [# T* T8 d! S
  22. 1 T, \# s* @3 E/ U
  23. [aaron@phoenix ~]$ su -
    4 B! H9 C( z- z& i/ w
  24. Password:[頛詨叵oot撖蝣奭
    ) v1 z: }' s$ u) J+ i& N
  25. [root@phoenix aaron]# echo $PATH#訐ATH霈賂雿輻禿ootPATH霈
    & V5 K& o& O8 l$ ~5 s% _. S$ H$ z
  26. /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
銴鋆賭誨蝣

$ n. q$ a' v# J7 {. G  c2. 閮剖sudoer
" d7 X8 X3 z; C( h8 M, y
  1. [aaron@phoenix ~]$ su
    ( w3 @% q7 i2 H2 \- K
  2. Password:[頛詨叵oot撖蝣奭( X' f! l$ {. A6 s

  3. / V# E9 N* _4 u2 Y) X; |5 K
  4. [root@phoenix aaron]# vim /etc/sudoers. B1 q4 w: c9 J2 x- q8 O
  5. 7 x2 y4 B  z: v7 k' u/ v: M
  6. ## Allow root to run any commands anywhere/ ^0 I/ L# e6 C
  7. root    ALL=(ALL)       ALL
    . C6 D( n. s; e
  8. * \0 w5 x" a. [0 i8 ~3 Q. \
  9. ## Allow users to run any commands anywhere6 H6 T! w1 R- e( K8 C6 Z1 k
  10. aaron   ALL=(ALL)       ALL#啣璇閮帶aron臭誑瑁蝞∠⊥
銴鋆賭誨蝣

) {4 f9 w& \- g" C. N) G, C3. 蝭靘
  1. #瘝擃甈嚗隞亙停鋡急鈭) k" r4 ^' C. p8 n4 u( f# y' `
  2. [aaron@phoenix ~]$ service httpd restart
    5 E- R, a# h. |; n4 l8 ~2 z" D
  3. Stopping httpd:) y7 ?' o% U5 \! }& \& `
  4. rm: cannot remove `/var/run/httpd/httpd.pid': Permission denied
    ; }7 V1 |: @2 t: M

  5. - {5 L7 i$ J& J, m3 i4 v8 r+ E
  6. Starting httpd:
    ) {* y  l8 u0 P" I$ L; q& u/ _4 ?0 G
  7. touch: cannot touch `/var/lock/subsys/httpd': Permission denied. k6 g( O* [! Y5 O* }. k
  8. % H) O. M  p; F9 A3 {
  9. #究udo撠勗臭誑
    2 H( Y. E/ `4 \  g$ Z6 R5 F
  10. [aaron@phoenix ~]$ sudo service httpd restart
    8 F1 A% C, d. e; N! R& f
  11. [sudo] password for aaron:[頛詨亙蝣奭
    " M) G8 u$ C, x* Z4 {  x6 W
  12. Stopping httpd:                                            [  OK  ]
    8 k: L: ?2 \$ G
  13. Starting httpd:                                            [  OK  ]
銴鋆賭誨蝣
#susudo撌桀亙冽潭臬西霈銝砌蝙刻仿root撖蝣潘憒究u撠勗撠root撖蝣澆鈭怠箏鳴敺航賡蝟餌絞鋡思噩亦梢芥sudo航銝砌蝙刻蝞∠⊥嚗芾頛詨亥芸楛撖蝣澆喳荔雿璅憸券迎箸蝞∠⊥
( n4 x$ ~' F2 R: Q9 j6 y' G
http://kezeodsnx.pixnet.net/blog/post/25810396

雿輻券

祉蝛閬

BT蝳

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

QQ|撠暺撅||52AV璈A

GMT+8, 2024-11-22 12:54 , Processed in 0.073360 second(s), 17 queries .

蝯∠.撱

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

鋆貉憒 敹恍敺 餈銵