- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Verify user
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
Discussions
Discussions
Forums
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
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
тАО01-22-2003 01:18 PM
тАО01-22-2003 01:18 PM
I'm hoping someone has a handy script that will allow me to verify a login. I would like to know if 'mrice' is valid. I can't just grep /etc/passwd because we run NIS.
Thanks for any ideas,
Mary Rice
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2003 01:23 PM
тАО01-22-2003 01:23 PM
SolutionI just happen to have something very clsoe in my /utils directory, Getpwnam.pl.
Use it like this:
USER="mrice"
Getpwnam.pl -q ${USER}
STAT=${?}
if [[ ${STAT} -eq 0 ]]
then
echo "${USER} is valid"
else
echo "${USER} ain't no good"
fi
The -q says only return a status; without it you get a list of passwd fields.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2003 01:25 PM
тАО01-22-2003 01:25 PM
Re: Verify user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2003 01:52 PM
тАО01-22-2003 01:52 PM
Re: Verify user
Thanks for the quick reply. Does this script work with NIS/NIS+ or will I need to modify it? It looks like it reads the passwd file.
Mary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2003 01:57 PM
тАО01-22-2003 01:57 PM
Re: Verify user
You should have asked your box rather than me but yes, Getpwnam.pl does read /etc/passwd BUT it also reads the NIS/NIS+ passwd map. Perl's getpwnam() function simply calls the underlying getpwnam() C libC function. It takes care of all of this for you. If no matching user is found in /etc/passwd and a '+' entry is founds then the NIS map is examined for a match.
This routine works equally well in the NIS and non-NIS worlds. Ain't Perl nice?
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2003 02:05 PM
тАО01-22-2003 02:05 PM
Re: Verify user
I'm sorry that I doubted you. I should have known better.
Thanks again,
Mary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2003 02:07 PM
тАО01-22-2003 02:07 PM
Re: Verify user
I trust you know that that was tongue in cheek.
Regards, Clay