2005年04月14日 星期四 12:18
Meaglith Ma wrote:
> 我在一个程序中执行一个命令,使用os.system()。
> 但是这个命令是root才有权限执行的,所以我想切换用户到root再执行怎么办
> 我在前面加了一个os.system('su root'),然后再执行os.system('my command')也不可以。
> 请教怎么来做呢?
>
os.system('su root -c my command')
--
Best regards,
Li Daobing
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://lists.exoweb.net/pipermail/python-chinese/attachments/20050414/df585bd6/signature.pgp
2005年04月14日 星期四 14:12
os.system('su root -c my command')
程序会挂在输入密码提示这里
还是sudo比较合理
或者在安全许可的条件下设置SUID也是可以考虑的
On 4/14/05, Li Daobing <lidaobing at gmail.com> wrote:
>
> Meaglith Ma wrote:
> > 我在一个程序中执行一个命令,使用os.system()。
> > 但是这个命令是root才有权限执行的,所以我想切换用户到root再执行怎么办
> > 我在前面加了一个os.system('su root'),然后再执行os.system('my command')也不可以。
> > 请教怎么来做呢?
> >
>
> os.system('su root -c my command')
>
> --
> Best regards,
>
> Li Daobing
>
>
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
>
>
>
>
--
In doG We Trust
http://www.hutuworm.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050414/b5bc6ed5/attachment-0001.html
2005年04月14日 星期四 14:18
如果执行程序的先需要root,再需要其它用户譬如cvs那怎么处理呢? sudo可以么? On 4/14/05, hutuworm <hutuworm at gmail.com> wrote: > > os.system('su root -c my command') > 程序会挂在输入密码提示这里 > 还是sudo比较合理 > 或者在安全许可的条件下设置SUID也是可以考虑的 > > On 4/14/05, Li Daobing <lidaobing at gmail.com> wrote: > > > Meaglith Ma wrote: > > > 我在一个程序中执行一个命令,使用os.system()。 > > > 但是这个命令是root才有权限执行的,所以我想切换用户到root再执行怎么办 > > > 我在前面加了一个os.system('su root'),然后再执行os.system('my command')也不可以。 > > > 请教怎么来做呢? > > > > > > > os.system('su root -c my command') > > > > -- > > Best regards, > > > > Li Daobing > > > > > > _______________________________________________ > > python-chinese list > > python-chinese at lists.python.cn > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > -- > In doG We Trust > http://www.hutuworm.org > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > > > -- 欢迎访问我的Blog: http://spaces.msn.com/members/meaglith/ http://blog.360.yahoo.com/genednaparadox ---------------------------------------- .--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/ ------------------------------------------------- 沧海笑 滔滔两岸潮 浮沉随浪记今朝 苍天笑 纷纷世上潮 谁负谁胜天知晓 江山笑 烟两遥 涛浪淘尽红尘俗也知多少 竟惹寂寥 一襟晚照 苍生笑 不再寂寥 豪情仍在痴痴笑笑 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050414/9610de76/attachment.htm
2005年04月14日 星期四 15:37
Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: Kebo Wang (kebowang at gmail.com).vcf Type: text/x-vcard Size: 313 bytes Desc: not available Url : http://lists.exoweb.net/pipermail/python-chinese/attachments/20050414/ebe894c0/KeboWangkebowanggmail.com.vcf
Zeuux © 2025
京ICP备05028076号