Forum Discussion

jan_de_wachter_'s avatar
jan_de_wachter_
Icon for Nimbostratus rankNimbostratus
Jan 29, 2018

iApp obtain username

We would like to log into an iApp the username of the person who executed this iApp. On the F5 we can obtain the username by typing who am i .

 

But when in my iApp I specify set vuserid [who am i] I get error undefined procedure: who.

 

How can I solve this or how can I get the username in my iApp??

 

  • Meanwhile I found the solution. Following command in the implementation section will set my variable vuserid. Scan the audit log for the last user that did logon in the GUI:

     

    set vuserid [exec cat /var/log/audit | grep "httpd(mod_auth_pam)" | grep "Administrator" | awk "{print \$11}" | tail -1]

     

    Since normally there is only one updating the F5 environment, this command should give us the name of the user executing the iApp.

     

    Note: the who am I command will give you your name when executing in tmsh shell, NOT in the GUI.