因为需要在shell脚本中增加这样的功能:
脚本是root用户启动, 需要在脚本中的某些地方使用指定的用户去运行命令
在python等语言中存在一个API: seteuid.
在系统都没有相似的命令.
看了一下bash的man手册, 只有两个read-only的变量.
现在本人是这样处理的:
# sudo -H -u www httpd
这里有一点要注意的, 就是使用sudo时的环境变量.
system administration is a craft
Friday, January 16, 2009
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment