Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Let users run scripts

I run hosting on my server for users discord.py bots i make for them.. they have ftp access to only their folder, scripts.


How can i let them run and stop files, their own files only?

python3 something.py
Its not possible to let them run anything (traditional) with FTP protocol,
and I guess you dont want to give them SSH access.
so your option is pretty much to code something that will do that for them.

If you already make discord bots, you can for example make another discord bot, that act as the "Manager" of and for your users,
im not sure how your run your bots internally but the implementation of that is based on how you run it ( docker, services etc.. )
Dude .
Don't give their users execution rights and don't allow them access to any other files.
It's generally a bad idea to give them access to your server and not a more restricted area like a webpanel.
This was solved with subprocess. I have a pre-set script that user ID can run, and typing the -start command runs their bots. They can't edit files, so no harm!
(Jul 13, 2022 05:25 AM)killaxia Wrote:  This was solved with subprocess. I have a pre-set script that user ID can run, and typing the -start command runs their bots. They can't edit files, so no harm!

I would like to see your subprocess implementation, my guess is that is vulnerable, the more proper/secure way to do it would be to create separate functions for each action and then to call these actions when the user enters a command or something. Though if it really is just between some really good friends, it's not to bad.. just know that it could be vulnerable.
(Jul 13, 2022 02:35 PM)Riddled Wrote:  I would like to see your subprocess implementation, my guess is that is vulnerable, the more proper/secure way to do it would be to create separate functions for each action and then to call these actions when the user enters a command or something. Though if it really is just between some really good friends, it's not to bad.. just know that it could be vulnerable.

I manually set the users file, so say its /var/bot/username/script.py

when someone says -start it just loads that filename and starts it, same for stop. there is no command line they can use and they cant edit anything. they cant stop/start other peoples work either

something like

if ctx.author.id = 134235325525:
file = something.py


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Avicti3Nov 24, 2017 11:25 AM 1 225 Nov 24, 2017 11:25 AM
Last Post: Hackoo
[Shell] by Mr KakeFeb 4, 2016 10:33 AM 8 243 Feb 4, 2016 10:33 AM
Last Post: jahwi
[Shell] by Jon SnowOct 3, 2014 12:10 PM 8 284 Oct 3, 2014 12:10 PM
Last Post: annikk.exe