1

I have a python script running on a home laptop that runs Ubuntu 13.10. I want to give 2 or 3 people the ability to start or kill that script, but no other privileges. I don't want to give them access to the script itself, since the code is sensitive. Is there an easy way to do that?

1

There are a thousand and one ways to do this.

One way you might consider is from a BasicAuth protected Apache server with PHP. PHP could exec the python script for you and also shell execute a kill on the same script.

PHP exec() - http://php.net/manual/en/function.exec.php

This is not the most robust, secure or best way to accomplish what you're wanting, but it technically fits the requirements and is simple to set up. It is pretty much guaranteed to make any administrator's hair stand on end.

If you want to use your python script longterm on a less than casual project you might consider porting it to be used with mod_python, recreate it for use in a web service, etc.

1

GNU/Linux has sudo command that permits user to become root or run some files that need root privileges. You should define your users at /etc/sudoers file. Of course you need to block some command, please read man sudoers , to can customize it.

  • 1
    You spelled /etc/sudoers wrong (swap the 'o' and 'u'). Also, it's highly recommended you use the visudo command instead of directly editing the /etc/sudoers file, due to the importance of what you're editing. – raehik Oct 25 '13 at 14:14
  • It's not mentioned in the text, but the title of the question mentions "via the internet". – Skippy le Grand Gourou Oct 25 '13 at 14:35
0

The easiest way would probably be to set up a simple webserver with a single webpage and a link to start/stop the script.

Or if your users are at ease with SSH clients, you could try to set an SSH jail (see e.g. this question).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.