Why execution of su - user -c 'command' gives an error "-ksh: line 1: 'command': not found" ?

Solution Verified - Updated -

Issue

  • On Red Hat Enterprise Linux 5 (64 bit) system, when I su to a user that has commands set in the env load, I see the following error message.

Eg:

[root@example ~]# su - mac -c "mac -a status"
-ksh: line 1: mac: not found
  • Vendor of "mac" application thinks that it is a Red Hat Enterprise Linux issue with /bin/su or ksh.

  • Why execution of su - user -c 'command' gives an error "-ksh: line 1: 'command': not found" ?

Environment

  • Red Hat Enterprise Linux 5
  • ksh

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.