Article 534RM Reg sudo - finding user

Reg sudo - finding user

by
manickaraja
from LinuxQuestions.org on (#534RM)
Hi,
I have a requirement to capture current user who runs a program. This program is run by a scheduler agent and that agent is spawned by a specific os user (tidaladm). That user internally run command as another service user (edwadm). Now inside program I want to capture original user (tidaladm). I tried below code snippet bot returns null.

osuser=$(who am i | awk '{print $1}')
osuser=$(ls -l $(tty) | awk '{print $3}')

Both these command return when I manually run it on terminaly. However program run thorough agent is giving this as NULL. Any idea how to get around it?

Thanks,
Manick.latest?d=yIl2AUoC8zA latest?i=0SyzkUgX1K8:HDvBT81QXpw:F7zBnMy latest?i=0SyzkUgX1K8:HDvBT81QXpw:V_sGLiP latest?d=qj6IDK7rITs latest?i=0SyzkUgX1K8:HDvBT81QXpw:gIN9vFw0SyzkUgX1K8
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments