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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content