|
|
0 t7 ?* A2 x$ e% S5 G# u
我们切换到root用户的时候,直接使用su 或者su -,但是有个问题是,需要输入密码。这样比较麻烦。我们可以让某个用户无密码登录到root用户,需要进行如下的设置:
& Q6 t" _) f( C5 n. H# n# K: f
' Y; O) m- s0 }1 vcat /etc/pam.d/su& ^, c, U; H% [7 O, W
#%PAM-1.0
3 f5 `" `$ x* f2 p5 A( `- N& B/ Eauth sufficient pam_rootok.so' [! h; k3 `$ @1 |5 p
# Uncomment the following line to implicitly trust users in the "wheel" group.
) `# T- i' a% S/ |! \" a2 e- J#auth sufficient pam_wheel.so trust use_uid
8 l! b; w: [. K p; e& J# Uncomment the following line to require a user to be in the "wheel" group.% d$ x: [% W; s7 m6 z, Q
#auth required pam_wheel.so use_uid# I F$ C- e) d' F
auth substack system-auth% H- \5 Y: b9 L7 C9 o( g4 _
auth include postlogin) M' M# Y% Y0 `& Z! O1 r, c
account sufficient pam_succeed_if.so uid = 0 use_uid quiet, {* c5 b7 o& y Z' r. c! _7 t
account include system-auth
1 ~! K/ R7 ^" ~ D( l4 y8 w) opassword include system-auth. L9 S/ @6 t/ E
session include system-auth* a! {; I- h J; B& ?0 S
session include postlogin0 ?* s1 |, S* B( a+ f, ^
session optional pam_xauth.so
. ?4 Y* s1 N: T2 [$ G- s+ w" z
. \5 \% {! W1 w: u: _; i
, X2 G4 @$ I! K8 n% N然后执行:
7 }! k: p! d6 i. Ugpasswd -a usename wheel 3 ~7 p* o8 S j) ^
即可!!!
: J. N2 o4 A- D3 i" ^$ ?3 o |
|