[PerlChina] 又一问题:如何切换用户权限?

truncatei truncatei at gmail.com
Thu Jun 5 00:58:05 PDT 2008


正常情况下,httpd以root身份启动,打开默认端口后(一般是80,*NIX需要root身份才能注册1024以下端口)切换回一般帐户运行,以避免一些安全问题。
如果确实需要httpd以root运行,找到http.conf文件
修改这部分:
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
#  . On SCO (ODT 3) use "User nouser" and "Group nogroup".
#  . On HPUX you may not be able to use shared memory as nobody, and the
#    suggested workaround is to create a user www and use that user.
#  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
#  when the value of (unsigned)Group is above 60000;
#  don't use Group nobody on these systems!
#
User www
Group www




2008/6/5 Achilles Xu <formalin14 at gmail.com>:
> 比较笨的办法是你用expect ssh登录回你的服务器(用root)然后执行相应操作。正规途径的话,你就得看看sudo了。
>
> 在08-6-5,gary.jsz <gary.jsz at gmail.com> 写道:
>>
>>
>> 现在又来一个问题。
>> 因为http的执行者是apache,那么,我怎么成切换高级用户的权限执行我要做的事情呢?
>>


More information about the China-pm mailing list