<?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 block user in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249937#M175191</link>
    <description>hey friends,&lt;BR /&gt;&lt;BR /&gt;              in my company there r some users who share login i want that at a time nomore than two users with same username can login..for eg:--username 'ashish' cannot be used more than two times... if any user does than a message is displayed...Please try after some time..&lt;BR /&gt;&lt;BR /&gt;thanx in advance</description>
    <pubDate>Fri, 16 Apr 2004 00:25:28 GMT</pubDate>
    <dc:creator>ashish_24</dc:creator>
    <dc:date>2004-04-16T00:25:28Z</dc:date>
    <item>
      <title>block user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249937#M175191</link>
      <description>hey friends,&lt;BR /&gt;&lt;BR /&gt;              in my company there r some users who share login i want that at a time nomore than two users with same username can login..for eg:--username 'ashish' cannot be used more than two times... if any user does than a message is displayed...Please try after some time..&lt;BR /&gt;&lt;BR /&gt;thanx in advance</description>
      <pubDate>Fri, 16 Apr 2004 00:25:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249937#M175191</guid>
      <dc:creator>ashish_24</dc:creator>
      <dc:date>2004-04-16T00:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: block user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249938#M175192</link>
      <description>Don't know how to do that but I would definitely not encurrage having more than one person using a login. Or put another way; if you do, why limit it to two?&lt;BR /&gt;If you MUST I guess some scripting in the profile is the best I can come up with.&lt;BR /&gt;&lt;BR /&gt;NUMBER=$(who | grep whoami | wc -l)&lt;BR /&gt;if [ $NUMBER -gt 2 ]&lt;BR /&gt;then&lt;BR /&gt;   echo "Please try after some time.."&lt;BR /&gt;   exit&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Trond&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Apr 2004 00:39:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249938#M175192</guid>
      <dc:creator>Trond Haugen</dc:creator>
      <dc:date>2004-04-16T00:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: block user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249939#M175193</link>
      <description>This question has been asked before, though in most cases with the request to be able to login only once...&lt;BR /&gt;&lt;BR /&gt;The simplest solution is to use the .profile of the user (if using a normal posix shell, the default. If using csh, you need to use .login) to check and block multiple sessions of the user, in your case when two sessions are active.&lt;BR /&gt;&lt;BR /&gt;The check would become something like this:&lt;BR /&gt;if [ $(who | grep ashish | wc -l) -gt 2 ]&lt;BR /&gt;then&lt;BR /&gt;   echo "Too many sessions active already. Please try again later."&lt;BR /&gt;   exit&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Mind that this shouldn't be editable by the users and non-interuptable! Non-interuptable can be done by ignoring all signals in the beginning of the profile:&lt;BR /&gt;trap "" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15&lt;BR /&gt;And at the end, before leaving:&lt;BR /&gt;trap - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15&lt;BR /&gt;&lt;BR /&gt;To make in un-editable you would need to put it in /etc/profile, which is not editable for the normal users. But then you need to make sure the user trying to login is ashish too.</description>
      <pubDate>Fri, 16 Apr 2004 00:47:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249939#M175193</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-04-16T00:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: block user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249940#M175194</link>
      <description>hey mr haugen&lt;BR /&gt;                 ur reply is not working, as u are trying to grep whoami text in the output of who but if u write the username in place of whoami or $(loganame)...i used $(logname) and it worked...anyway thanx for ur help.. rest of ur code was ok..&lt;BR /&gt;&lt;BR /&gt;ashish&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Apr 2004 01:03:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249940#M175194</guid>
      <dc:creator>ashish_24</dc:creator>
      <dc:date>2004-04-16T01:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: block user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249941#M175195</link>
      <description>Yes ashish you are right.&lt;BR /&gt;Think I'll need another caffee. Here is the corrected script as you pointed out.&lt;BR /&gt;&lt;BR /&gt;NUMBER=$(who | grep $(whoami) | wc -l)&lt;BR /&gt;if [ $NUMBER -gt 2 ]&lt;BR /&gt;then&lt;BR /&gt;   echo "Please try after some time.."&lt;BR /&gt;   exit&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Trond&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Apr 2004 01:06:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249941#M175195</guid>
      <dc:creator>Trond Haugen</dc:creator>
      <dc:date>2004-04-16T01:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: block user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249942#M175196</link>
      <description>thank u mr kolkman,&lt;BR /&gt;&lt;BR /&gt;         ur solution was perfect especially the trap sequence and .profile moving to /etc dir...but i thenk we can do it one more way if we change ownership of .profile to that of root and make it readonly ....will that work...bye&lt;BR /&gt;&lt;BR /&gt;thanx to all who helped me</description>
      <pubDate>Fri, 16 Apr 2004 01:18:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249942#M175196</guid>
      <dc:creator>ashish_24</dc:creator>
      <dc:date>2004-04-16T01:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: block user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249943#M175197</link>
      <description>That might work, but then you also need to change the ownership of the home directory, otherwise the user might do a rename of .profile (he is by default the owner of his own homedirectory, so he may write it and move files around in it, even though he is not the owner of the file) and re-create a .profile, using the old .profile as starting point:&lt;BR /&gt;&lt;BR /&gt;mv .profile .profile.root&lt;BR /&gt;cat .profile.root &amp;gt; .profile&lt;BR /&gt;chmod 755 .profile&lt;BR /&gt;&lt;BR /&gt;Now he is owner and can change things in it as he wishes. That's why I suggested using /etc/profile.&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Apr 2004 01:33:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/block-user/m-p/3249943#M175197</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-04-16T01:33:25Z</dc:date>
    </item>
  </channel>
</rss>

