Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need if/then statement in /etc/profile

Status
Not open for further replies.

sjcrane

MIS
Jan 18, 2006
41
US
I have Active Directory authentication running on my system but I need to setup so that if root logs in you get prompt but if other users via AD login it executes a script in /etc/profile:

> .sh_history
exec csession cache -U HHM "^ZU"
exit


This way all users can run the application and then exit.But root will goto the prompt #.

I was thinking something like "if UID=>0 exec .....


Any help would be appreciated

 
'whoami' should work, but this parses the id command to get the real user:

Code:
# get the real user id
realuser=$(id|sed -e 's,^[^(]*(,,' -e 's,).*$,,' -e 1q)
case $realuser in
   root | olded )
    echo "root or olded"
    ;;
   *)
    echo "blah"
      exit 0
    ;;
esac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top