Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-50679

VNC service does not start if user does not have a shell set in /etc/passwd

    • tigervnc-1.13.1-11.el9
    • No
    • Low
    • 1
    • rhel-sst-display-productivity
    • ssg_display
    • 23
    • 24
    • 2
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • DESKTOP Cycle #4 10.beta phase
    • All
    • None

       

      What were you trying to do that didn't work?

      The VNC service does no start if the configured user has an empty shell field in the password entry, either in /etc/passwd or via AD/IPA/NIS. An empty shell field in the password file is valid, although not common. In this case, /bin/sh is used, as documented in the passwd(5) manual page.

      Please provide the package NVR for which bug is seen:

      How reproducible:

      Steps to reproduce

      1. Add a local user and use vipw to empty the last field in the password file
      2. Configure a vnc service using that local user
      3. Start the service

      Expected results

      Service should start normally.

      Actual results

      Service fails a ~/.vnc/<hostname><display>.log contains something like this:

      Using desktop session gnome
      
      New 'rhel-8-4:1 (vncuser1)' desktop is rhel-8-4:1
      
      Starting desktop session gnome
      
      
      Xvnc TigerVNC 1.12.0 - built Mar 28 2023 04:56:36
      Copyright (C) 1999-2021 TigerVNC Team and many others (see README.rst)
      See https://www.tigervnc.org for information on TigerVNC.
      Underlying X server release 12011000, The X.Org Foundation
      
      
      Fri Jul 26 10:39:02 2024
       vncext:      VNC extension running!
       vncext:      Listening for VNC connections on all interface(s), port 5901
       vncext:      created VNC server for screen 0
      xinit: XFree86_VT property unexpectedly has 0 items instead of 1
      
      ** (process:49761): WARNING **: 10:39:02.258: Could not make bus activated clients aware of XDG_CURRENT_DESKTOP=GNOME environment variable: Could not connect: Connection refused
      xinit: connection to X server lost
      
      waiting for X server to shut down  ComparingUpdateTracker: 0 pixels in / 0 pixels out
       ComparingUpdateTracker: (1:-nan ratio)
       

      Additional information

      The problem happens because the SHELL environment variable is set by vncsession before running the vncserver script:

       

      struct passwd *pwent;
      ...
      pwent = getpwnam(username);
      ...
      setenv("SHELL", *pwent->pw_shell);

      So if the shell field is empty the script will run with an empty SHELL environment variable. In order to prevent this error, the code should be like this:

      setenv("SHELL", *pwent->pw_shell != '\0' ? pwent->pw_shell : "/bin/sh", 1);
      

       

       

              jgrulich@redhat.com Jan Grulich
              rhn-support-casantos Carlos Santos
              Jan Grulich Jan Grulich
              Radek Duda Radek Duda
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: