[sudo-users] Editing sudoers from python

Marcus Dean Adams marcusdean.adams at gmail.com
Tue Oct 10 09:55:26 EDT 2006


I'm currently working on a python project, and it involves compiling
software and to make sure the user can run the compiled software, I need
to make sure that 'make' is ran as that user, so I'm revising my
installer bash script and just sticking sudo in everywhere that root
permissions would be needed, but here's my question.  I'd never used
sudo until now, I'd always just became root directly with "su", and when
I tried running it I noticed that by default, I wasn't a member of
sudoers, and I had to add myself and I figured if I had the problem
other people will too.  My question is, is it possible to import and
edit /etc/sudoers like a normal text file with python, or do you really
"have" to use visudo?  I noticed it won't accept changes from any other
regular text editor such as gedit, but if I could somehow automate the
process of giving the current user permission to run sudo with this
python script, it would be really handy.  It would make things a lot
easier than trying to explain using visudo, I want this installer I'm
writing to be as hands-off as possible.




More information about the sudo-users mailing list