Article 6FMMN allow users to execute a Python File but not read

allow users to execute a Python File but not read

by
JJJCR
from LinuxQuestions.org on (#6FMMN)
Hi guys,

Is it possible to allow users to run/execute a python file but don't allow them to read its content?

I tried --x permission, Python file will not run.

r-x, Python file will run but of course they can view and see the contents of the file.

I search the web, one way is to create a user with sudo account , no passwd and no shell login.

change the permission of the Python file to 700 and assign it to the sudo account as per above.

Then create a file in /etc/sudoers.d/ to allow a sudo user to run the Python file.

It works, user is not able to view the contents of the file and able to execute it.

However, the file has to be used by all users on the system.

It will be a security risk by allowing all users as sudoer to run the file.

Any other methods to do this? allow user to run/execute the Python file but don't allow them to view the contents of the file. Thanks.
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments