View Single Post
Posts: 3,664 | Thanked: 1,530 times | Joined on Sep 2009 @ Hamilton, New Zealand
#4
Originally Posted by aeol View Post
You can't get root privileges inside the script: it is very insecure. You should write instead
Code:
import os
os.system('echo 78 > /abc/abc/bca')
or even better
Code:
open('/abc/abc/bca', 'w').write('78')
and run this script with root privileges

I've tried that, I'm trying to echo to swappiness


os.system('echo 60> /proc/sys/vm/swappiness')

You can't write to a file that only root can access.
but result is not working via python. But it working via xterminal python as root.

Last edited by maxximuscool; 2010-09-04 at 09:12.
 

The Following User Says Thank You to maxximuscool For This Useful Post: