'service sshd stop' gives the error - /sbin/service: line 67: 6654 Terminated env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS}

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5
  • openssh-server

Issue

  • 'service sshd stop' gives the error:

/sbin/service: line 67:  6654 Terminated              env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS}

Resolution

The openssh init script was modified. Revert to the original version of the script to fix this error:

rpm -e --justdb openssh-server --nodeps
yum install openssh-server

Diagnostic Steps

The change in init script:

stop()
{
-       echo -n $"Stopping $prog: "
-       if [ -n "`pidfileofproc $SSHD`" ] ; then
-           killproc $SSHD
-       else
-           failure $"Stopping $prog"
-       fi
-       RETVAL=$?
-       # if we are in halt or reboot runlevel kill all running sessions
-       # so the TCP connections are closed cleanly
-       if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then
-           killall $prog 2>/dev/null
-       fi
-       [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/sshd
-       echo
+#      echo -n $"Stopping $prog: "
+       killall sshd
+#      if [ -n "`pidfileofproc $SSHD`" ] ; then
+#          killproc $SSHD
+#      else
+#          failure $"Stopping $prog"
+#      fi
+#      RETVAL=$?
+#      # if we are in halt or reboot runlevel kill all running sessions
+#      # so the TCP connections are closed cleanly
+#      if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then
+#          killall $prog 2>/dev/null
+#      fi
+#      [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/sshd
+#      echo
}

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments