Jump to content

Specific Permissions For A Python Script


TheNavigator

Recommended Posts

I'm making a way of communication between a site and a server. User uploads a python file, the server then compiles it and returns the output.

 

Everything works perfectly. The only problem is that script file can access other directories and mess with things. The script deals with only 2 files, "input" and "output". How can I make such thing? Any instructions?

 

Any help is much appreciated :) Thanks.

Link to comment
Share on other sites

You need to create a simple user to execute this service as. You then make the files this service requires access to be owned by that user.

 

The idea of someone being able to upload a script sounds dodgy, what exactly are you trying to do?

Link to comment
Share on other sites

Sorry for the late reply.

 

It's something very advanced and complicated (as reported by experts who are responsible for the informatic olympiads here. For me it wasn't that hard). An algorithm server.

 

Ever heard about Codeforces, TopCoder, USACO, Z-Training, etc. ? The international olympiad for informatics?

 

For your reply, that means I need to turn that "python script" into a service then. True?

Edited by TheNavigator
Link to comment
Share on other sites

How to make a user and certain its permissions not to access other directories?

 

The user I use, although it's a sudoer, but without using sudo commands it can play with stuff, make files here and there, delete some files, etc.

 

How can I prevent this so the only directory the user can access is the one I specify it for him?

Link to comment
Share on other sites

Lock the rest of the system down. Users cannot generally create files or edit files anywhere that they can damage anything.

 

There is no simple one stop quick fix, it's just typical sys admin stuff. Can you be specific about where it is your stuck or what it is you don't understand?

Link to comment
Share on other sites

  • 3 weeks later...

After searching for sometime, what I want to do is something like a chroot jail, or an rSSH. Locking the user to a specified directory. chroot looks fine but it's much more than what I actually need. I've also seen Jailkit, but I can't figure out how to make that work on CentOS

 

I guess I need more experience :|

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.