Skip to ContentSkip to Footer
Start of content
- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - Linux
- >
- General
- >
- C programming question: how to verify userid/passw...
General
-
- Forums
-
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
- HPE Blog, Austria, Germany & Switzerland
- Blog HPE, France
- HPE Blog, Italy
- HPE Blog, Japan
- HPE Blog, Middle East
- HPE Blog, Latin America
- HPE Blog, Russia
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
-
Blogs
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Blog, Latin America
- HPE Blog, Middle East
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
-
Information
- Community
- Welcome
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Tips and Tricks
- Resources
- Announcements
- Email us
- Feedback
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Aruba Airheads Community
- Enterprise.nxt
- HPE Dev Community
- Cloud28+ Community
- Marketplace
-
Forums
-
Blogs
-
Information
-
English
Topic Options
- 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
- Email to a Friend
- Report Inappropriate Content
12-23-2003 03:50 AM
12-23-2003 03:50 AM
C programming question: how to verify userid/password on Unix OS (hp or linux)
Hi,
Is there any functions that can be used to verify userid/password without worring about whereabouts of the password: /etc/passwd , /etc/shadow or somewhere else?
I am used to use 'getpwent' to do password verification on our HP machine, but when I moved the code to Linux, it didn't work because the encrypted password resides in /etc/shadow instead of /etc/passwd.
Any help is highly appreciated!
Liping
Is there any functions that can be used to verify userid/password without worring about whereabouts of the password: /etc/passwd , /etc/shadow or somewhere else?
I am used to use 'getpwent' to do password verification on our HP machine, but when I moved the code to Linux, it didn't work because the encrypted password resides in /etc/shadow instead of /etc/passwd.
Any help is highly appreciated!
Liping
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-23-2003 04:15 AM
12-23-2003 04:15 AM
Re: C programming question: how to verify userid/password on Unix OS (hp or linux)
Hello Liping,
not sure if there is a way to avoid putting some logic about the passwd location into the
program, but using fgetpwent and/or the shadow
routines (man shadow) you should be able to get at the data you need.
Greetings, Martin
not sure if there is a way to avoid putting some logic about the passwd location into the
program, but using fgetpwent and/or the shadow
routines (man shadow) you should be able to get at the data you need.
Greetings, Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-30-2003 12:39 AM
12-30-2003 12:39 AM
Re: C programming question: how to verify userid/password on Unix OS (hp or linux)
When doing it from a shell script, you could do it with su:
su -c /bin/true
The problem with doing it from a C-program is that the encrypted passwd is not accessible for normal users, only root, on systems using the /etc/shadow (linux/solaris) or trusted (hp-ux) environments.
So, even if you do program it correctly, you have to have root privileges to make it work... meaning a new possible security hole. You might, of course, try the system command to start the su line like in a shell script. That should work...
su
The problem with doing it from a C-program is that the encrypted passwd is not accessible for normal users, only root, on systems using the /etc/shadow (linux/solaris) or trusted (hp-ux) environments.
So, even if you do program it correctly, you have to have root privileges to make it work... meaning a new possible security hole. You might, of course, try the system command to start the su line like in a shell script. That should work...
Every problem has at least one solution. Only some solutions are harder to find.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-30-2003 08:54 AM
12-30-2003 08:54 AM
Re: C programming question: how to verify userid/password on Unix OS (hp or linux)
Hi
There is pam Pluggable Authentication Module
There is pam Pluggable Authentication Module
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
End of content
United States
Hewlett Packard Enterprise International
Communities
- Communities
- HPE Blogs and Forum
© Copyright 2021 Hewlett Packard Enterprise Development LP