我有一些关于subprocess.call'行为和保护http服务器。在
以下代码示例在不使用/使用shell时有所不同:
sudo python -c "from subprocess import call; from os import setreuid, setregid; setreuid(1000,0); setregid(1000,0); call(['touch','./aaa'])"
生成“root”拥有的文件。在
生成用户1000拥有的文件。在
在第一种情况下,产生一个由有效用户拥有的文件,在第二种情况下生成一个真正用户拥有的文件的原因是什么?在
python2.6(没有“setresuid”)中是否有一种方法可以在python代码中临时(安全地)更改用户?在
使用特权有效用户来临时更改真实用户以提高/降低权限是否安全?在
你可以使用sudo:
当您的
/bin/sh
是bash
时,可能会发生这种情况,因为bash将有效用户id设置为实际用户id,除非在启动时提供-p
选项。在这在documentation中描述:
相关问题 更多 >
编程相关推荐