[systemd-devel] vncserver at .service

Colin Guthrie gmane at colin.guthr.ie
Wed Jan 23 09:14:44 PST 2013

'Twas brillig, and Antonio at 23/01/13 15:54 did gyre and gimble:
> Am 23.01.2013 16:29, schrieb Antonio:
>>>> and why do you not use the User= and Group= options?
>>> Because they are not required by instructions.
>> as also runuser, but one is native systemd the other not
> runuser is already written in the file.

Well, whereever that file came from, it's wrong. systemd has built in
tools to switch user and they should be used as things like runuser and
su have a tendency to create their own sessions which is often not what
you want.

>>> However I have just tried but permission error remains.
>>> ... User=antonio Group=antonio ...
>> what about NOT reply offlist and provide informations like the
>> output of "systemctl status" as also the current content of the
>> unit-file?
> I'm replying even on systemd-devel list.
> I'm working with unit-file on Fedora ARM on Raspberry but I'm also
> replying you by Fedora on notebook.
> However: http://www.fpaste.org/NA2M/

That unit looks messy :s

Try this:

Description=Remote desktop service (VNC)

ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/usr/bin/vncserver %i -geometry 1024x600 -depth 24 -fp
ExecStop=/usr/bin/vncserver -kill %i


Some notes:

1. syslog.target is old and not needed in recent systemd's

2. No need to shell out and ignore the return value of the Pre command.
Use the - after the equals to ignore the return value of the command.
It's output will be logged in the journal but that's fine IMO.

3. User=/Group= is a built in way to set the user and group. You should
drop runuser completely as it's totally unneeded - systemd has this
built in as documented in the manual.

4. I'm not sure of the %i usage above. You r spec mixed and matched a
hard-coded :1 and some use of %i. If your service is
vncserver at 1.service, then you'll want to include the : in the commands,
but if you are e.g. using vncserver at 5900.service then I guess it's just
an absolute number? (I forget the syntax of VNC server so forgive me if
this is wrong!)

5. If you ultimately try to run vncserver with a 1 argument (meaning
desktop :1 but actually translated directly as tcp port 1 then this may
account for a permission error (regular users cannot listen on TCP ports
< 1024). Make sure you get your :1 vs. 1 correct.



Colin Guthrie

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/

More information about the systemd-devel mailing list