- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Finding user script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2002 12:08 PM
04-03-2002 12:08 PM
Does anyone has script that I can run to find out or search for a users on mutiple system. Thanks in advance.
Mike
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2002 12:10 PM
04-03-2002 12:10 PM
Re: Finding user script
rwho works like who, but can list users on multiple systems.
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2002 12:14 PM
04-03-2002 12:14 PM
Re: Finding user script
If you want to look at the users "logged" onto the other systems, you can use the command rwho or rusers. But you should have rusersd configured in /etc/inetd.conf file.
If you want to check each system for the users configured on the system, you would need to have remote access on the system through either SSH or REMSH.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2002 12:17 PM
04-03-2002 12:17 PM
Re: Finding user script
No, I need to search through password file to find if they exist or not.
Thanks,
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2002 12:18 PM
04-03-2002 12:18 PM
Re: Finding user script
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2002 12:23 PM
04-03-2002 12:23 PM
Re: Finding user script
If you got your remsh set up on the systems.
you can do
remsh serverA "grep user1 /etc/passwd"
and that would give you the line for user1 in /etc/passwd in serverA.
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2002 12:25 PM
04-03-2002 12:25 PM
SolutionYou mean you want to see taht user entry is exist on passwd file on remote system?
You have to run remsh for each system and grep for that user in passwd file
Here is simple loop
for i in sys1 sys2 sys2
do
echo $i
remsh $i cat /etc/passwd |grep username
done
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2002 12:34 PM
04-03-2002 12:34 PM
Re: Finding user script
Now in this example hotnames.file is a file that has a list of the hostnames that you want to check. And we can do the grep with -i so the grep on the username wont be case sensitive.
#!/bin/sh
REMOTES=hostnames.file
for REMOTE in $(cat $REMOTES)
do
echo '#####################'
echo ""
remsh ${REMOTE} -l root "hostname,grep -i username /etc/passwd"
done
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2002 12:41 PM
04-03-2002 12:41 PM
Re: Finding user script
If you have ssh configured across your servers then even easier...
ssh hostname1 '/usr/bin/grep username /etc/passwd'
ssh hostname2 '/usr/bin/grep username /etc/passwd'
ssh hostname3 '/usr/bin/grep username /etc/passwd'
ssh hostname4 '/usr/bin/grep username /etc/passwd'
You could put a for loop around it too (see Sachin's example replace remsh line with ssh line)
-Shabu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2002 01:37 PM
04-03-2002 01:37 PM
Re: Finding user script
I didn't know that you can do like
for REMOTE in $(cat $REMOTES)
I does
cat $REMOTES | while read line;
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2002 01:50 PM
04-03-2002 01:50 PM
Re: Finding user script
Thanks Richard and Sachin. I had something like this was in place but your loop is nice.
LINE=`cat mike.list1`
for i in $LINE
do
remsh $i hostname
remsh $i grep -i 'will' /etc/passwd
remsh $i grep -i 'wast' /etc/passwd
remsh $i grep -i 'schve' /etc/passwd
done
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2002 08:29 PM
04-03-2002 08:29 PM
Re: Finding user script
Mike,Sachin
come on guys lets rememeber we are living in a unix world.What does that mean to us? Well it means that to every "one" way that we know to do something there are probably 1000 or more ways to do the same thing. I would be willing to bet that Mr. Jrf or Mr. Clay could turn our 5 line script into a 500 line script just for fun and give us the same result.And I am sure they could just as easly put it in a one liner once again with the same results.
Why am I ramblin on? I dont really know maybe cuss it is 10:30pm and I am on the forum and have nothing better to do. Is this what being single and 26 all about?lol
Back to my point. Yes I have a point. There are so many ways to do the same things. And that is why we are all here to LEARN. That's whats its all about my friends.That is one of the great advantages of this great resourse we call the forum brought to us by another great resourse that has changed the world forever called the internet. WOW what a gift. The power to interact with your peers all over the world 24 hours a day 7 days a week in a choosen profession or intrest.Isnt life great?
Well I am done for now. Gotta go get me another beer.
Richard :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2002 01:06 PM
04-04-2002 01:06 PM
Re: Finding user script
Thanks to all of you for your quick reply. Every one was great. Thanks to all of you and Richard just for the last reply I gave you 10 points because you were up at 10.00 pm. Once again thanks for your help.
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2002 05:38 PM
04-04-2002 05:38 PM
Re: Finding user script
wc /etc/passwd
will give you an output of three diffrent numbers like
56 245 3456
56 is the amount of lines in /etc/passwd file
245 is the amount of words in the /etc/passwd file
3456 is the amount of characters in the /etc/passwd file
oh yes and it just so happens that the set of numbers to the far left the 56 indicates how many users accounts you have on that particular box, well at least i think so