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

Exit code of command executed through ForceCommand is not expected one

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • rhel-9.5
    • openssh
    • None
    • No
    • Moderate
    • rhel-sst-security-crypto
    • ssg_security
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • None
    • None
    • None
    • None

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

      When executing a command through ForceCommand, I would expect that the exit code of the command reflects on the client side.
      This is the case, except for commands dying because of a signal, which in that case reflects as "255" on the client side, instead of "128+signumber".

      What is the impact of this issue to you?

      Issues knowing why a command failed.

      Please provide the package NVR for which the bug is seen:

      openssh-8.7p1 (RHEL9)
      openssh-9.8p1 (Fedora 41)

      How reproducible is this bug?:

      Always

      Steps to reproduce

      1. Define a Match block forcing the command in /etc/ssh/sshd_config and restart sshd
        Match User user
            ForceCommand $SSH_ORIGINAL_COMMAND
      2. Execute a command through ssh from a client system
        $ ssh user@localhost sleep 1234
      3. From another shell, kill the command
        $ pkill -HUP sleep

      Expected results

      Exit code 129

      Actual results

      Exit code 255

              dbelyavs@redhat.com Dmitry Belyavskiy
              rhn-support-rmetrich Renaud MĂ©trich
              Dmitry Belyavskiy Dmitry Belyavskiy
              Miluse Bezo Konecna Miluse Bezo Konecna
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: