I start my VNC server via a @reboot vncserver & entry in my user's crontab.

But this seems to cause some problems since the cron environment is restricted. For examples see:

So I would like to know a better way for starting a VNC server for a user under his account.

  • 1
    you can try adding it to your systemd startup, see penguintutor.com/linux/tightvnc Commented Apr 4, 2017 at 16:13
  • But this seems to run vnc server as root. I want to run the vnc server for two different users under their accounts. Commented Apr 4, 2017 at 16:26
  • 1
    "this seems to run vnc server as root" -> No. Look at line 8 of the startup config file given there and see man systemd.exec.
    – goldilocks
    Commented Apr 4, 2017 at 16:41
  • Alright. It is a fixed user for a service which needs to be installed by root. So this requires a vnc-user.service for every user. I hope that with the right ownership a user could also restart his vnc.service. I prefer a method which does not involve root (like crontab) more but maybe this provides an alternative solution if cron doesn't work. Commented Apr 4, 2017 at 17:02
  • This is the same issue as discussed in your other question; probably one of these questions should be made more general and the other deleted.
    – cjs
    Commented Apr 5, 2017 at 17:36

1 Answer 1


In your crontab, run your login shell with the option that does full login processing and have it run vncserver, e.g.:

bash -l -c vncserver

This will ensure that a) your preferred shell is used, and b) /etc/profile and your .bash_profile or .profile are read.

  • I tried this already, but it doesn't seem to fix issues related to PAM or polkit or whatever the problem is. Commented Apr 5, 2017 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.