<?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: Help with user delete script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441779#M357399</link>
    <description>&lt;!--!*#--&gt;You can remove evil cats with:&lt;BR /&gt;export RMVLST=$(&amp;lt; usr.lst)&lt;BR /&gt;for X in $(&amp;lt; srv.lst); do&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I get the ERROR saying "grep can't open rmod.&lt;BR /&gt;ssh ${X} grep ^$RMVLSTa /etc/passwd.test&lt;BR /&gt;&lt;BR /&gt;This is basically tring to grep ALL of the tokens in usr.lst.  grep will only take one token at a time, unless you use "-f file".  Or another loop:&lt;BR /&gt;&lt;BR /&gt;for user in $RMVLST; do&lt;BR /&gt;   ssh ${X} grep ^$user /etc/passwd.test&lt;BR /&gt;&lt;BR /&gt;(I'm not sure if that "a" is a typo?)&lt;BR /&gt;&lt;BR /&gt;If you can send that file over to each system or have it NFS accessible, you could have "^name" on each line.&lt;BR /&gt;&lt;BR /&gt;Or you can copy that passwd file back to your machine and process it there.</description>
    <pubDate>Wed, 17 Jun 2009 16:18:53 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2009-06-17T16:18:53Z</dc:date>
    <item>
      <title>Help with user delete script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441778#M357398</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I need to remove bunch of user that has UID "0" on my systems.&lt;BR /&gt;&lt;BR /&gt;I have filter out all the users with the UIO "0" and have the list, also I have the server list for ssh.&lt;BR /&gt;&lt;BR /&gt;What I am trying to fo is write simple loop something like this.  but it's not working.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;export RMVLST=$(cat usr.lst)&lt;BR /&gt;for X in $(cat srv.lst)&lt;BR /&gt;do&lt;BR /&gt;ssh ${X} grep ^$RMVLSTa /etc/passwd.test&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I get the ERROR saying "grep can't open rmod.&lt;BR /&gt;&lt;BR /&gt;Appreciate your help.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for the help.&lt;BR /&gt;&lt;BR /&gt;MJ</description>
      <pubDate>Wed, 17 Jun 2009 16:09:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441778#M357398</guid>
      <dc:creator>Mike_305</dc:creator>
      <dc:date>2009-06-17T16:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help with user delete script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441779#M357399</link>
      <description>&lt;!--!*#--&gt;You can remove evil cats with:&lt;BR /&gt;export RMVLST=$(&amp;lt; usr.lst)&lt;BR /&gt;for X in $(&amp;lt; srv.lst); do&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I get the ERROR saying "grep can't open rmod.&lt;BR /&gt;ssh ${X} grep ^$RMVLSTa /etc/passwd.test&lt;BR /&gt;&lt;BR /&gt;This is basically tring to grep ALL of the tokens in usr.lst.  grep will only take one token at a time, unless you use "-f file".  Or another loop:&lt;BR /&gt;&lt;BR /&gt;for user in $RMVLST; do&lt;BR /&gt;   ssh ${X} grep ^$user /etc/passwd.test&lt;BR /&gt;&lt;BR /&gt;(I'm not sure if that "a" is a typo?)&lt;BR /&gt;&lt;BR /&gt;If you can send that file over to each system or have it NFS accessible, you could have "^name" on each line.&lt;BR /&gt;&lt;BR /&gt;Or you can copy that passwd file back to your machine and process it there.</description>
      <pubDate>Wed, 17 Jun 2009 16:18:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441779#M357399</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-06-17T16:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Help with user delete script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441780#M357400</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Thanks for the quick reply.&lt;BR /&gt;&lt;BR /&gt;Yes, it was typo.&lt;BR /&gt;&lt;BR /&gt;I did the way you are suggesting and get the following result.&lt;BR /&gt;&lt;BR /&gt;ERROR = ssh: grep: no address associated with name&lt;BR /&gt;&lt;BR /&gt;export RMVLST=$(&amp;lt; usr.list)&lt;BR /&gt;export SRVLST=$(&amp;lt; srv.lst)&lt;BR /&gt;for user in $RMVLST&lt;BR /&gt;do&lt;BR /&gt;ssh $SRVLST grep ^$user /etc/passwd.test&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Thanks in advance - MJ&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Jun 2009 16:48:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441780#M357400</guid>
      <dc:creator>Mike_305</dc:creator>
      <dc:date>2009-06-17T16:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help with user delete script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441781#M357401</link>
      <description>How about put "^$user".</description>
      <pubDate>Wed, 17 Jun 2009 16:57:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441781#M357401</guid>
      <dc:creator>Tingli</dc:creator>
      <dc:date>2009-06-17T16:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Help with user delete script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441782#M357402</link>
      <description>&amp;gt;ERROR = ssh: grep: no address associated with name&lt;BR /&gt;&lt;BR /&gt;&amp;gt;export RMVLST=$(&amp;lt; usr.list)&lt;BR /&gt;&amp;gt;export SRVLST=$(&amp;lt; srv.lst)&lt;BR /&gt;&amp;gt;for user in $RMVLST&lt;BR /&gt;&amp;gt;do&lt;BR /&gt;&amp;gt;ssh $SRVLST grep ^$user /etc/passwd.test&lt;BR /&gt;&amp;gt;done&lt;BR /&gt;&lt;BR /&gt;Again, biting more than you can chew.&lt;BR /&gt;&lt;BR /&gt;with this command&lt;BR /&gt;&lt;BR /&gt;&amp;gt;ssh $SRVLST grep ^$user /etc/passwd.test&lt;BR /&gt;&lt;BR /&gt;you are assuming you will loop thru the server list one server at a time, whereas ssh thinks all of those servers are one single server and crying fould not finding this server.&lt;BR /&gt;&lt;BR /&gt;what you need to do&lt;BR /&gt;&lt;BR /&gt;for s in $SRVLST&lt;BR /&gt;do&lt;BR /&gt;for u in $RMVLST&lt;BR /&gt;do&lt;BR /&gt;ssh ${s} "grep ${u} /etc/passwd.tst"&lt;BR /&gt;done #for variable u&lt;BR /&gt;done #for variable s&lt;BR /&gt;&lt;BR /&gt;hope this helps</description>
      <pubDate>Wed, 17 Jun 2009 17:09:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441782#M357402</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-06-17T17:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help with user delete script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441783#M357403</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;The error "ssh: grep: no address associated with name"&lt;BR /&gt;&lt;BR /&gt;...suggests that your variable ${X} is empty.  you can see this if you did:&lt;BR /&gt;&lt;BR /&gt;# ssh grep ^$RMVLST /etc/passwd&lt;BR /&gt;&lt;BR /&gt;...where ${RMVLST} is defined.&lt;BR /&gt;&lt;BR /&gt;For :&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;export RMVLST=$(&amp;lt; usr.list)&lt;BR /&gt;export SRVLST=$(&amp;lt; srv.lst)&lt;BR /&gt;for user in $RMVLST&lt;BR /&gt;do&lt;BR /&gt;    ssh $SRVLST grep ^$user /etc/passwd.test&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;...as Dennis already noted, you need another loop to walk the list contained in ${SRVLST}.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;RMVLST=$(&amp;lt; usr.list)&lt;BR /&gt;SRVLST=$(&amp;lt; srv.lst)&lt;BR /&gt;for user in ${RMVLST}&lt;BR /&gt;do&lt;BR /&gt;    for host in ${SRVLST}&lt;BR /&gt;    do&lt;BR /&gt;        ssh -n ${host} grep ^${user} /etc/passwd.test&lt;BR /&gt;    done&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;...Notice too that you do not need to 'export' your variables into your shell's environment.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 17 Jun 2009 17:15:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441783#M357403</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-06-17T17:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Help with user delete script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441784#M357404</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Ok, I am half way to my mission.  A little help from you GURU's can put me in little success ship.  LOL&lt;BR /&gt;&lt;BR /&gt;This is what I came up with.  I can run locally but I need to run on the remote server using ssh.  I defiantly copy the working files over to each server.&lt;BR /&gt;&lt;BR /&gt;And here is the loop, the issue is ssh part is not working.  Please help.&lt;BR /&gt;&lt;BR /&gt;#!/usr/sbin/sh&lt;BR /&gt;#export SRVLST=$(&amp;lt; srv.lst)&lt;BR /&gt;set -A users $(&amp;lt; user.list)&lt;BR /&gt;echo ${users[*]}&lt;BR /&gt;for user in ${users[*]}&lt;BR /&gt;do&lt;BR /&gt;#ssh $(SRVLST) grep ^${user##/*} /etc/passwd.test&lt;BR /&gt;grep ^${user##/*} /etc/passwd.test&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Thanks in advance - MJ&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Jun 2009 17:20:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441784#M357404</guid>
      <dc:creator>Mike_305</dc:creator>
      <dc:date>2009-06-17T17:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Help with user delete script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441785#M357405</link>
      <description>Sorry I did not see JRF's response.  I will try that and let you know.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;MJ</description>
      <pubDate>Wed, 17 Jun 2009 17:21:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441785#M357405</guid>
      <dc:creator>Mike_305</dc:creator>
      <dc:date>2009-06-17T17:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with user delete script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441786#M357406</link>
      <description>Hello All,&lt;BR /&gt;&lt;BR /&gt;I tried your options and now I can ssh into the server no prblem but my grep is not listing the user from the password file and not even giving me error.&lt;BR /&gt;&lt;BR /&gt;Should I just copy the script to local node and then ssh to each server and just run it?&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;RMVLST=$(&amp;lt; usr.lst)&lt;BR /&gt;SRVLST=$(&amp;lt; srv.lst)&lt;BR /&gt;for user in ${RMVLST}&lt;BR /&gt;do&lt;BR /&gt;for host in ${SRVLST}&lt;BR /&gt;do&lt;BR /&gt;ssh ${host} "grep ^${user} /etc/passwd"&lt;BR /&gt;done&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Thanks for everyones help.&lt;BR /&gt;&lt;BR /&gt;MJ&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Jun 2009 20:43:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441786#M357406</guid>
      <dc:creator>Mike_305</dc:creator>
      <dc:date>2009-06-17T20:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help with user delete script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441787#M357407</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I tried your options and now I can ssh into the server no prblem but my grep is not listing the user from the password file and not even giving me error&lt;BR /&gt;&lt;BR /&gt;Try isolating a test case at the command line:&lt;BR /&gt;&lt;BR /&gt;# ssh -n somehost "grep ^root /etc/passwd"&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Jun 2009 22:28:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441787#M357407</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-06-17T22:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help with user delete script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441788#M357408</link>
      <description>Hello James,&lt;BR /&gt;&lt;BR /&gt;I tried from command line and it works.&lt;BR /&gt;&lt;BR /&gt;ssh -n $SRVLST "grep ^root /etc/passwd"&lt;BR /&gt;&lt;BR /&gt;ssh -n rp5470-prd "grep ^root /etc/passwd"&lt;BR /&gt;&lt;BR /&gt;I think I need test this out by pushing the user.list file on to all my server and then run the loop.&lt;BR /&gt;&lt;BR /&gt;Thanks for helping me out, appreciate that very much.&lt;BR /&gt;&lt;BR /&gt;Any ideas are welcome.&lt;BR /&gt;&lt;BR /&gt;JRF - Thanks again....&lt;BR /&gt;&lt;BR /&gt;I will keep trying until I break it....LOL&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;MJ</description>
      <pubDate>Thu, 18 Jun 2009 00:38:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441788#M357408</guid>
      <dc:creator>Mike_305</dc:creator>
      <dc:date>2009-06-18T00:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help with user delete script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441789#M357409</link>
      <description>&amp;gt;I think I need test this out by pushing the user.list file on to all my server and then run the loop.&lt;BR /&gt;&lt;BR /&gt;Yes, unless you want to login multiple times.&lt;BR /&gt;Or you can copy the password file back to your machine, then process it.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;set -A users $(&amp;lt; user.list)&lt;BR /&gt;&lt;BR /&gt;You really aren't buying much by creating an array.</description>
      <pubDate>Thu, 18 Jun 2009 07:21:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-user-delete-script/m-p/4441789#M357409</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-06-18T07:21:32Z</dc:date>
    </item>
  </channel>
</rss>

