Advertisement
Guest User

systemd-issue

a guest
Mar 19th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.00 KB | None | 0 0
  1. Hey guys, we have a ldap/kerberos backend we use for users on our Stretch systems. We then use nss_updatedb ldap to populate user database on each workstation. All users are represented when doing a getent passwd and id $USER works fine. PAM is configured to be aware of the users in ldap/kerberos and they can login/ssh fine to the workstations.
  2.  
  3. nsswitch contains the following
  4.  
  5. passwd: files db
  6. group: files db
  7.  
  8.  
  9. For a handfull of users in ldap, we need to run a vncserver instance. I copied the instructions from the arch wiki for setting up a service file to run tigervnc and my test user (created locally and in passwd) worked fine. vncserver is started as the proper user, and the DE fires up and ready to vnc into.
  10.  
  11. When I ported over the service file for a user not in the passwd file, the vncservice wouldn't start, failing with no HOME environment variable found as reported by journalctl.
  12.  
  13. root@SERVER2:/etc/systemd/system# getent passwd |grep test.user
  14. test.user:*:20334:100:test.user:/home/test.user:/bin/bash
  15. root@SERVER2:/etc/systemd/system# id test.user
  16. uid=20334(test.user) gid=100(users) groups=100(users)
  17.  
  18. -- Subject: Unit vncserver@:3.service has begun start-up
  19. -- Defined-By: systemd
  20. -- Support: https://www.debian.org/support
  21. --
  22. -- Unit vncserver@:3.service has begun starting up.
  23. Mar 19 16:29:13 SERVER2 systemd[1]: Started Remote desktop service (VNC).
  24. -- Subject: Unit vncserver@:3.service has finished start-up
  25. -- Defined-By: systemd
  26. -- Support: https://www.debian.org/support
  27. --
  28. -- Unit vncserver@:3.service has finished starting up.
  29. --
  30. -- The start-up result is done.
  31. Mar 19 16:29:13 SERVER2 vncserver[2737]: vncserver: The HOME environment variable is not set.
  32. Mar 19 16:29:13 SERVER2 systemd[1]: vncserver@:3.service: Main process exited, code=exited, status=1/FAILURE
  33. Mar 19 16:29:13 SERVER2 vncserver[2741]: vncserver: The HOME environment variable is not set.
  34. Mar 19 16:29:13 SERVER2 systemd[1]: vncserver@:3.service: Control process exited, code=exited status=1
  35. Mar 19 16:29:13 SERVER2 systemd[1]: vncserver@:3.service: Unit entered failed state.
  36. Mar 19 16:29:13 SERVER2 systemd[1]: vncserver@:3.service: Failed with result 'exit-code'.
  37.  
  38. So I edited the service file and defined a HOME environment variable like so
  39.  
  40. [Unit]
  41. Description=Remote desktop service (VNC)
  42. After=syslog.target network.target
  43.  
  44. [Service]
  45. Type=simple
  46. User=test.user
  47. Environment=HOME=/home/test.user
  48. PAMName=login
  49. PIDFile=/home/%u/.vnc/%H%i.pid
  50. ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
  51. ExecStart=/usr/bin/vncserver %i -AlwaysShared -name test.user-VNC -geometry 1920x1080 -alwaysshared -fg -localhost no
  52. ExecStop=/usr/bin/vncserver -kill %i
  53.  
  54. [Install]
  55. WantedBy=multi-user.target
  56.  
  57. reload systemd and when I try to fire up the service, it now runs, but it's root thats running the service rather then the users. All config files created by firing up the DE (xfce in this case) are owned by root.
  58.  
  59. root@SERVER2:/etc/systemd/system# psef vncserver
  60. vnc 974 1 0 15:54 ? 00:00:00 /usr/bin/perl /usr/bin/vncserver :12 -AlwaysShared -name vnc-VNC -geometry 1920x1080 -alwaysshared -fg -localhost no
  61. root 2825 1 0 16:36 ? 00:00:00 /usr/bin/perl /usr/bin/vncserver :2 -AlwaysShared -name first.last-VNC -geometry 1920x1080 -alwaysshared -fg -localhost no
  62. root 3507 1 1 16:42 ? 00:00:00 /usr/bin/perl /usr/bin/vncserver :3 -AlwaysShared -name test.user-VNC -geometry 1920x1080 -alwaysshared -fg -localhost no
  63.  
  64. The vnc user is the initial local user in passwd, but first.last and test.user are both users that are not in passwd but in getent databases. The unit files are all identical between the 3, other then the usernames (and the defined HOME var now)
  65.  
  66. Fair warning, first exposure to systemd, but I cannot figure out why systemd is escalating the process' to root ownership when I want them running as certain users. It works as you think it should with local users, but not with our ldap users.
  67.  
  68. Thanks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement