Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Kind of an interesting project here. I'm trying to think of the best way to have a job start up on it's own when a system (running CentOS 5) boots up. The job is a simple python script. However, there are some interesting conditions that need to be met:
- As stated, script needs to start and run in the background when the system boots up, but without anyone logging in.
- This script needs to be readable only by root, which means it will need to be run as root
- Only 1 person will have root access, meaning nobody else will have access to see this script or it's status.
The entire point is to have this thing running all the time, even if the system reboots, but to make it so nobody can see the script or view it's source, unless they have root access, which only 1 person will have.
I can think of plenty of ways to have things start up automatically when a system comes up, but they all involve having the user log in as part of it. How can I have a listening python script start up, at boot up, on it's own, without root actually logging in?
1) Forget about the running the script as root. Create a non-root user specifically for this task and run the script as that user. The root user will still be able to "read" it, and limiting it to one locked down user + root isn't really any different.
2) Stating only one user will have access to root is not true if the script is run as root. One user plus anybody else who can circumvent this script would have access to root. Only one person would have access to root if it is run as a different user even if someone circumvents it.
3) Without knowing much more about the functionality of the script, I would say run it as a daemon rather than w/ cron.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.