this post was submitted on 03 Mar 2025
32 points (97.1% liked)

Linux

52837 readers
457 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

I could use some help. I'm a pretty noobish linux user and have a linux server (running headless ubuntu). I use it for basic provisions of computer services, and to learn.

For the most part I've been able to stumble through the tasks I want to take on. One of the programs my server runs is Teamspeak, and it is always running. When i reboot the server, it's the first thing I fire back up. I've been aware of systemd for some time now and this has been a prime candidate, but I've been putting off setting up any services. I figured the time has come. Holy crap, what a vortex systemd has proven to be.

When I built my server I read that it's good practice to run the software that users will be connecting to through a non-admin account, so I did that. I have a non-admin account that I tmux my various server software on manually.

Reading some systemd tutorials, I've built a service file and I'm trying to register it on my non-admin account, but I get an error when I try to run systemctl --user daemon-reload: "Failed to connect to bus: No medium found". I do not get this error when I run it on the admin account.

All the documentation I can find has got my head spinning. I'm pretty sure you need a doctorate in comp sci to understand the various man pages and webpages.

I mean hi there: https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#Options

Like holy fsck: https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html

I think the real question that I'm looking for is if I should be configuring services to run through my admin account, configuring services with my admin account to run as a specific user, or configuring services through my specific user account?

Also, something like Teamspeak, which just needs to run when the server is up and running, does it need before and after definitions, or if I omit them will that work fine?

Any tips, tricks or tutorials are appreciated!

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 29 points 1 month ago (1 children)

Instead of using systemd user services you can just use a normal systemd service and tell it to run the command as a specific user, put something like this in a file at /etc/systemd/system/.service

[Unit]
Description=Run service as user test
After=network.target

[Service]
Type=simple
User=test
Group=test
ExecStart=/opt/teamspoke

[Install]
WantedBy=default.target

Then set it to start at boot

systemctl enable <unit Name>.service

And to start it now

systemctl start <unit Name>.service
[–] [email protected] 11 points 1 month ago

Best answer.

Extra tip: You can combine the two last commands with: systemctl enable --now <unit name>.service