How do I set up systemd for a script to startup on boot?
Posted by AverNotBigGay@reddit | linux | View on Reddit | 14 comments
I’m trying to set up a systemd service to automatically start my python honeypot script on every system boot, inside of a terminal. However, the honeypot needs root access to listen to the ports. How can I set up systemd to automatically start up the script in a terminal GUI on every system boot so I can see the live outputs?
ipsirc@reddit
Wow, it's very clever to run honeypot as root user. I've never even thought about that.
VALTIELENTINE@reddit
Clever? Seems like a terrible idea. Why would you give a part of your pc publicly accessible and designed to attract bad actors root access to your system?
AverNotBigGay@reddit (OP)
Im new to linux and I didn’t even think about that 😭 im so dumb
radiocate@reddit
You really, really should not be operating a honeypot. You have no idea what you're doing.
A good place to start would be renting a VM from a host somewhere and running only the honeypot on it. Don't ever connect to this machine directly from one of your own, use the web console or a second VM with access to the first.
I'm not trying to be a dick, operating a honeypot can be very dangerous, and you've shown a lack of understanding of the fundamentals. Everyone has to start somewhere, this could be a good learning experience, but please for the love of god don't run this on your own system.
Maybe put it in a Docker container for another layer between the host and the honeypot. Then you can write a docker compose file with
restart: always
to have it run at startup.AverNotBigGay@reddit (OP)
Thats literally what im doing, i made a vm specifically to learn about these things.
ipsirc@reddit
Because i'm dumb?
“Blessed are the poor in spirit, for theirs is the kingdom of heaven." - Matthew%205:3-12
radiocate@reddit
First, this is a terrible idea. Second, use
@reboot
for your schedule.Skaarj@reddit
Too lazy to google the most basic function of systemd?
No.
https://manpages.debian.org/trixie/manpages/capabilities.7.en.html#CAP_NET_BIND_SERVICE
https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#AmbientCapabilities=
AverNotBigGay@reddit (OP)
Sorry, im new to linux so I don’t know all of the specifics. Im just trying to learn more about it and getting frustrated because i get conflicting information from many sources. And I did google it but got no relevant information. If you have any more advice or help it would be greatly appreciated
AutoModerator@reddit
This submission has been removed due to receiving too many reports from users. The mods have been notified and will re-approve if this removal was inappropriate, or leave it removed.
This is most likely because:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
freedomlinux@reddit
No it does not. CAP_NET_BIND_SERVICE
ten-oh-four@reddit
I’d highly recommend not running this as root. I’d give a non privileged dummy user permission to those ports using some other means.
Systemd scripts are pretty simple. I’m texting from phone or id share examples. You can launch the script as a specific user from systemd at boot and you can control and monitor it from a privileged user account.
gotsomefish@reddit
Go learn how to use unit files.
Xu_Lin@reddit
Here