Ask Your Question
0

Setting Systemd for automatic user start

asked 2014-01-16 04:41:13 -0600

ArKam gravatar image

updated 2014-04-11 16:34:52 -0600

remjg gravatar image

Hi there!

I'm currently building a tomcat server. Using the old fashioned SysInitV system, I was able to start Tomcat server with a limited user named "tomcat".

No that I'm working with FE19 I've to deal with Systemd, which is really interesting for my needs.

I already have create the service script like this:

[Unit]
Description=Tomcat Web Server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
ExecStart=/usr/local/java/bin/java org.apache.catalina.startup.Bootstrap start
ExecStop=/usr/local/java/bin/java org.apache.catalina.startup.Bootstrap stop
Type=forking

[Install]
WantedBy=multi-user.target

Which is located under

/lib/systemd/user/tomcat.service

If I try to launch an instance of this script with my root account (copy/paste of the service on system directory rather than the current user), everything is ok, I've got my tomcat running smoothly BUT it's under root ownership and for usage/security reason, I don't want this situation happen.

If I try to launch it through my tomcat user I got the following error:

[tomcat@01162014 ~]$ systemctl enable tomcat.service

Failed to issue method call: Access denied

I then try to check my systemctl on user context and got the following error:

[tomcat@01162014 ~]$ systemctl --user status

Failed to get D-Bus connection: /bin/dbus-launch terminated abnormally without any error message

So is anybody out there have a working tutorial on HOW TO ACTIVATE SYSTEMD FOR USERS ON FE19 ? It would be much appreciate :D

edit retag flag offensive close merge delete

Comments

I think in this case you want to run the service as one specific user "tomcat", and not tomcat.service available to all users. Check out this complete example https://wiki.fysik.dtu.dk/ase/development/buildbot.html#fedora for a buildbot instance - i'm not sure this is the recommended way, but it works for me. I'm using /usr/lib/systemd/system giving the specific User/Group instead of /usr/lib/systemd/user

marcindulak gravatar imagemarcindulak ( 2014-01-16 07:55:25 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-01-20 02:51:52 -0600

ArKam gravatar image

Hello everyone,

indeed I finally found another workaround which is perfectly what I'm looking for.

At a first glance, I'd planned to use a user specific init script, but in fact, I was rather looking for a script launched by root with the Tomcat ownership, thing that could be achieved using USER= and GROUP= specific directive on a root systemctl service script.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-01-16 04:41:13 -0600

Seen: 3,802 times

Last updated: Jan 20 '14