<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: script help please in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656253#M47248</link>
    <description>Robin,&lt;BR /&gt;&lt;BR /&gt;your script is close, but there is a "then" that is not matched.&lt;BR /&gt;&lt;BR /&gt;??</description>
    <pubDate>Fri, 08 Feb 2002 18:16:25 GMT</pubDate>
    <dc:creator>Nick D'Angelo</dc:creator>
    <dc:date>2002-02-08T18:16:25Z</dc:date>
    <item>
      <title>script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656248#M47243</link>
      <description>Below is a script that is a combination of two scripts and it will not work.&lt;BR /&gt;&lt;BR /&gt;What I am trying to do is to limit logins so that users that like to walk around to different pc's and telnet from different IP addresses, will be prevented from doing so.&lt;BR /&gt;&lt;BR /&gt;I want to limit their logins if they are already logged in from another ip address.&lt;BR /&gt;&lt;BR /&gt;I have a problem with a 'fi' but I it has me.&lt;BR /&gt;&lt;BR /&gt;here is the script:&lt;BR /&gt;&lt;BR /&gt;_______________&lt;BR /&gt;if [ -x "/usr/bin/whoami" ]&lt;BR /&gt;then&lt;BR /&gt;WHOAMI=`whoami`&lt;BR /&gt;&lt;BR /&gt;if [ "$WHOAMI" = "root" -o "$WHOAMI" = "nickd" ]&lt;BR /&gt;        then&lt;BR /&gt;        :&lt;BR /&gt;        else &lt;BR /&gt;        IPLIST=`who -u|tr -s " "|cut -d" " -f8` &lt;BR /&gt;        THISIP=`who -um | tr -s " " | cut -d" " -f8`&lt;BR /&gt;        LOGCOUNT=0&lt;BR /&gt;        for IP_ADDY in `echo $IPLIST` ; do &lt;BR /&gt;        if [ "${IP_ADDY}" -eq "${THISIP}" ]; then&lt;BR /&gt;                ((LOGCOUNT = LOGCOUNT +1 ))&lt;BR /&gt;&lt;BR /&gt;        echo $LOGCOUNT&lt;BR /&gt;        if [ $LOGCOUNT -gt 1 ] then&lt;BR /&gt;        echo "You are already logged on in more than one place" &lt;BR /&gt;        exit&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;here is the script:</description>
      <pubDate>Thu, 31 Jan 2002 13:00:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656248#M47243</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2002-01-31T13:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656249#M47244</link>
      <description>I haven't really checked if the script is working from functionality stand point. Instead just "fi" ed. &lt;BR /&gt;&lt;BR /&gt;Thanks,</description>
      <pubDate>Thu, 31 Jan 2002 13:15:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656249#M47244</guid>
      <dc:creator>Madhu Sudhan_1</dc:creator>
      <dc:date>2002-01-31T13:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656250#M47245</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;If you are going to limit logins why check for ip's&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You can prevent a user from logging in multiple times by&lt;BR /&gt;placing the following lines in the user's .profile:&lt;BR /&gt;&lt;BR /&gt;  # Limit number of logins allowed&lt;BR /&gt;   Times_allowed=2&lt;BR /&gt;   Time_in=`who | grep $LOGNAME | wc -l`&lt;BR /&gt;     if [ $Time_in -gt "$Times_allowed" ]&lt;BR /&gt;     then&lt;BR /&gt;        echo "$LOGNAME is already logged in $Times_allowed times!"&lt;BR /&gt;        exit&lt;BR /&gt;        exec /bin/login&lt;BR /&gt;     fi&lt;BR /&gt;&lt;BR /&gt;chmod 444 and chown root .profile&lt;BR /&gt;&lt;BR /&gt;If the user attempts to login while that login name is already in&lt;BR /&gt;use, the user will get logged out again.  A limited number of multiple&lt;BR /&gt;logins can be allowed by changing the times_allowed to the acceptable&lt;BR /&gt;number of logins.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This should also be ok in the /etc/profile.&lt;BR /&gt;&lt;BR /&gt;Whever they login from they come through these scripts.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;       Steve Steel</description>
      <pubDate>Thu, 31 Jan 2002 13:20:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656250#M47245</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2002-01-31T13:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656251#M47246</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The script that you posted is actually missing three 'fi's and a 'done'.&lt;BR /&gt;&lt;BR /&gt;I think that this bit should read:&lt;BR /&gt;&lt;BR /&gt;((LOGCOUNT = LOGCOUNT +1 ))&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;You also need two fi's at the end to close:&lt;BR /&gt;&lt;BR /&gt;if [ "$WHOAMI" = "root" -o "$WHOAMI" = "nickd" ]&lt;BR /&gt;and&lt;BR /&gt;if [ -x "/usr/bin/whoami" ]&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John&lt;BR /&gt;</description>
      <pubDate>Thu, 31 Jan 2002 13:22:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656251#M47246</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2002-01-31T13:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656252#M47247</link>
      <description>Hi Nick,&lt;BR /&gt;&lt;BR /&gt;You have one "done" and a few "fi" statements missing, and the line:&lt;BR /&gt;&lt;BR /&gt;  if [ "${IP_ADDY}" -eq "${THISIP}" ]; then &lt;BR /&gt;&lt;BR /&gt;should be:&lt;BR /&gt;&lt;BR /&gt;  if [ "${IP_ADDY}" = "${THISIP}" ]; then &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;=====================================&lt;BR /&gt;if [ -x "/usr/bin/whoami" ] &lt;BR /&gt;then &lt;BR /&gt;WHOAMI=`whoami` &lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if [ "$WHOAMI" = "root" -o "$WHOAMI" = "nickd" ] &lt;BR /&gt; then &lt;BR /&gt;: &lt;BR /&gt;else &lt;BR /&gt; IPLIST=`who -u|tr -s " "|cut -d" " -f8` &lt;BR /&gt; THISIP=`who -um | tr -s " " | cut -d" " -f8` &lt;BR /&gt; LOGCOUNT=0 &lt;BR /&gt; for IP_ADDY in `echo $IPLIST` ; do &lt;BR /&gt;  if [ "${IP_ADDY}" = "${THISIP}" ]; then &lt;BR /&gt;   ((LOGCOUNT = LOGCOUNT +1 )) &lt;BR /&gt;&lt;BR /&gt;   echo $LOGCOUNT &lt;BR /&gt;&lt;BR /&gt;   if [ $LOGCOUNT -gt 1 ] ; then &lt;BR /&gt;    echo "You are already logged on in more than one place" &lt;BR /&gt;    exit &lt;BR /&gt;   fi &lt;BR /&gt;  fi&lt;BR /&gt; done&lt;BR /&gt;fi&lt;BR /&gt;=====================================&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Thu, 31 Jan 2002 13:23:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656252#M47247</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-01-31T13:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656253#M47248</link>
      <description>Robin,&lt;BR /&gt;&lt;BR /&gt;your script is close, but there is a "then" that is not matched.&lt;BR /&gt;&lt;BR /&gt;??</description>
      <pubDate>Fri, 08 Feb 2002 18:16:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656253#M47248</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2002-02-08T18:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656254#M47249</link>
      <description>Hi Nick:&lt;BR /&gt;&lt;BR /&gt;Did you cut-and-paste Robin's script? -- it's fine.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 08 Feb 2002 18:29:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656254#M47249</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-02-08T18:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656255#M47250</link>
      <description>Gents,&lt;BR /&gt;&lt;BR /&gt;Yes I copied Robin's script and I get an error mesg:&lt;BR /&gt;&lt;BR /&gt;Syntax error: `then` is not matched.&lt;BR /&gt;&lt;BR /&gt;??</description>
      <pubDate>Fri, 08 Feb 2002 18:33:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656255#M47250</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2002-02-08T18:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656256#M47251</link>
      <description>here is my /etc/profile for your review.&lt;BR /&gt;&lt;BR /&gt;I thought this might save some emails from going around.&lt;BR /&gt;&lt;BR /&gt;Much appreciated.&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Feb 2002 18:41:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656256#M47251</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2002-02-08T18:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656257#M47252</link>
      <description>This is a section of a script to do something similar and while back.   Sorry it's in csh.  Thats what I used to write in.  I've since learned better ;)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/csh&lt;BR /&gt;&lt;BR /&gt;set username = `whoami`&lt;BR /&gt;&lt;BR /&gt;# If display not set, get IP and set&lt;BR /&gt;if($?DISPLAY == 0) then&lt;BR /&gt;  # Check for multiple logons of same user name.  Warn if found.&lt;BR /&gt;  if(`finger -R | grep $username  | awk '{print $NF}' | sort -u | wc -w` &amp;gt; 1) then&lt;BR /&gt;    echo "ERROR: User $username logged in on multiple terminals."&lt;BR /&gt;    echo "Can't determine IP address where you are logged in."&lt;BR /&gt;    exit 1&lt;BR /&gt;  endif</description>
      <pubDate>Fri, 08 Feb 2002 18:45:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656257#M47252</guid>
      <dc:creator>Tom Danzig</dc:creator>
      <dc:date>2002-02-08T18:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656258#M47253</link>
      <description>Hi Nick:&lt;BR /&gt;&lt;BR /&gt;OK, it looks like you dropped a 'fi' at line number 163.&lt;BR /&gt;&lt;BR /&gt;Add 'fi' so the last part reads:&lt;BR /&gt;&lt;BR /&gt;# Change the backup tape&lt;BR /&gt;&lt;BR /&gt;        if [ -r /tmp/changetape ]&lt;BR /&gt;        then    echo "\007\nYou are the first to log in since backup:"&lt;BR /&gt;                echo "Please change the backup tape.\n"&lt;BR /&gt;                rm -f /tmp/changetape&lt;BR /&gt;        fi&lt;BR /&gt;&lt;BR /&gt;fi # &amp;lt;&amp;lt;&amp;lt;--- THIS WAS MISSING !!!&lt;BR /&gt;# Leave defaults in user environment.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 08 Feb 2002 19:48:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656258#M47253</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-02-08T19:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656259#M47254</link>
      <description>Cheers James and many thanks.&lt;BR /&gt;&lt;BR /&gt;Nickd</description>
      <pubDate>Sun, 10 Feb 2002 12:14:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656259#M47254</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2002-02-10T12:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656260#M47255</link>
      <description>Sorry all, one more time.&lt;BR /&gt;&lt;BR /&gt;The last script that I received from James works,except for one problem.&lt;BR /&gt;&lt;BR /&gt;It locks everyone out  completely except for the exception list.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Feb 2002 18:32:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656260#M47255</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2002-02-20T18:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656261#M47256</link>
      <description>Nick, &lt;BR /&gt;&lt;BR /&gt;James is right in that there is an unmatched if in your script.&lt;BR /&gt;&lt;BR /&gt;I think the place to stick it, though is at the end of the section where you are testing for VUE environment stuff, right before the test for logins.&lt;BR /&gt;&lt;BR /&gt;Counting if s  and fi s to ensure they balance is a pain, but not being able to log in is worse......&lt;BR /&gt;&lt;BR /&gt;hth</description>
      <pubDate>Wed, 20 Feb 2002 19:11:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656261#M47256</guid>
      <dc:creator>Mark Fenton</dc:creator>
      <dc:date>2002-02-20T19:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656262#M47257</link>
      <description>All,&lt;BR /&gt;&lt;BR /&gt;I did include that last fi, and the script works, but not as designed.  &lt;BR /&gt;&lt;BR /&gt;It locks everyone out, except the users listed on the exception list.&lt;BR /&gt;&lt;BR /&gt;I have attached the profile for your review.&lt;BR /&gt;&lt;BR /&gt;Thanks for your time,&lt;BR /&gt;&lt;BR /&gt;Nd</description>
      <pubDate>Wed, 20 Feb 2002 19:46:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656262#M47257</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2002-02-20T19:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656263#M47258</link>
      <description>All,&lt;BR /&gt;&lt;BR /&gt;Should I re-post this?&lt;BR /&gt;&lt;BR /&gt;Nickd&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Feb 2002 16:16:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656263#M47258</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2002-02-26T16:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656264#M47259</link>
      <description>Try this...  I just modified the login limit section in your profile script:&lt;BR /&gt;&lt;BR /&gt;# Limit logins to 2&lt;BR /&gt;&lt;BR /&gt;USER=`logname`&lt;BR /&gt;LOGINS=`who -H | grep -c $USER`&lt;BR /&gt;&lt;BR /&gt;### Debug info...&lt;BR /&gt;print "Current logins:  $LOGINS"&lt;BR /&gt;&lt;BR /&gt;### Search $USER for exceptions&lt;BR /&gt;ALLOWTHESE="rbudaric|pics|tladouce|nickd"&lt;BR /&gt;echo $USER | egrep "$SKIPTHESE"&lt;BR /&gt;rc=$?&lt;BR /&gt;&lt;BR /&gt;if [ $rc -eq 1 ]  ### If this user is not part of the exception list&lt;BR /&gt;then &lt;BR /&gt;        if [ $LOGINS -gt 2 ]&lt;BR /&gt;            then        echo The maximum # of logins is 2&lt;BR /&gt;                        echo and you have already reached your limit.&lt;BR /&gt;                        echo &lt;BR /&gt;                        echo Nickd ext 278 Kanata&lt;BR /&gt;                        echo Pausing for 10 seconds&lt;BR /&gt;   touch /tmp/$USER&lt;BR /&gt;   /usr/sbin/sendmail $USER                         sleep 10&lt;BR /&gt;   #sendmail $USER                         exit&lt;BR /&gt;        fi&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Feb 2002 16:47:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656264#M47259</guid>
      <dc:creator>Bryan_6</dc:creator>
      <dc:date>2002-02-26T16:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656265#M47260</link>
      <description>Bryan,&lt;BR /&gt;&lt;BR /&gt;Thanks for the tip, but I think we are missing the second part of my problem.&lt;BR /&gt;&lt;BR /&gt;I also want to restrict users from using more than one computer (IP address) unless they are in the exception list.&lt;BR /&gt;&lt;BR /&gt;I couldn't tell for sure, but I don't think your script does that, does it?&lt;BR /&gt;&lt;BR /&gt;Nickd</description>
      <pubDate>Tue, 26 Feb 2002 16:50:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656265#M47260</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2002-02-26T16:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656266#M47261</link>
      <description>Sorry Nick - didn't look near the bottom of the script.  I've attempted to come up with a solution for you...&lt;BR /&gt;&lt;BR /&gt;I've tested this in my own .profile and it appears to work.  Let me know...</description>
      <pubDate>Tue, 26 Feb 2002 17:35:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656266#M47261</guid>
      <dc:creator>Bryan_6</dc:creator>
      <dc:date>2002-02-26T17:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: script help please</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656267#M47262</link>
      <description>Bryan,&lt;BR /&gt;&lt;BR /&gt;Works like a charm.&lt;BR /&gt;&lt;BR /&gt;The only problem is, all the files that it spawns in /tmp.&lt;BR /&gt;&lt;BR /&gt;Does the script need those mailmesg files or can I delete them?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;nickd</description>
      <pubDate>Thu, 07 Mar 2002 18:36:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-please/m-p/2656267#M47262</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2002-03-07T18:36:18Z</dc:date>
    </item>
  </channel>
</rss>

