Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • Hm, I need to find the path as db2inst1 user not as current user. Current user doesn't have access to this file. Commented Nov 7, 2012 at 0:31
  • Could you explain why $PATH is displayed correctly for sudo -u db2inst1 but running a file that is in the $PATH fails? Commented Nov 7, 2012 at 0:32
  • @Radek Oh, I think I misread the question, your symptoms are not exactly the usual ones. What is the output of sudo -u db2inst1 sh -c "type db2"? Do you have access to the sudoers file, and if so, what are the relevant settings (the applicable Defaults lines and the line that let you run db2 as db2inst1)? Commented Nov 7, 2012 at 0:38
  • sudo -u db2inst1 sh -c "type db2" gives me sh: line 0: type: db2: not found Commented Nov 7, 2012 at 0:47
  • 1
    @Radek Scratch that, I misread your question the second time. sudo -u db2inst1 sh -c "id;$PATH;ls /opt/ibm/db2/V9.7/bin/db2" expands PATH in the outer shell. You do find db2 in the current user's path, not in db2inst1's path. Commented Nov 7, 2012 at 0:56