HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Updating passwords using PAM functions
Operating System - HP-UX
1829535
Members
1738
Online
109992
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
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
- Report Inappropriate Content
05-01-2001 09:01 AM
05-01-2001 09:01 AM
Hi,
I'm creating a login program that uses functions supported by PAM. It compares passwords with another system & if the passwords are different I want to update the password on the unix machine to match the machine I'm checking with. Right now I'm using fgetpwent to find the user & keep a file pointer to the position in the file to update. I'm using putpwent to overwrite the password file entry. This means I must know which file to open. Is this the correct way to be updating passwords or is there a better way?
Also at a later date I need to be able to get this working with systems running NIS. Are there different functions used to update passwords?
Thanks,
Kristin
I'm creating a login program that uses functions supported by PAM. It compares passwords with another system & if the passwords are different I want to update the password on the unix machine to match the machine I'm checking with. Right now I'm using fgetpwent to find the user & keep a file pointer to the position in the file to update. I'm using putpwent to overwrite the password file entry. This means I must know which file to open. Is this the correct way to be updating passwords or is there a better way?
Also at a later date I need to be able to get this working with systems running NIS. Are there different functions used to update passwords?
Thanks,
Kristin
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2001 09:25 AM
05-01-2001 09:25 AM
Solution
Unless you specifically are wanting to examine files other then /etc/passwd you can use getpwent(),putpwent() and no worry about the pathname. You should also be aware of another wrinkle; trused & non-trusted systems. On trusted systems you must augment your getpwent()'s and putpwent()'s with getprpwent()'s and setprpwent()'s which update the trusted database entries.
With NIS, check out the yppasswd (3) function
which will update the NIS map's on the fly. You can always choose to use the standard passwd functions on the primary NIS server and then invoke ypmake to update and push the NIS maps. In any event, you are basically on the right track.
--- Hope some of this helps, Clay
With NIS, check out the yppasswd (3) function
which will update the NIS map's on the fly. You can always choose to use the standard passwd functions on the primary NIS server and then invoke ypmake to update and push the NIS maps. In any event, you are basically on the right track.
--- Hope some of this helps, Clay
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2001 02:09 PM
05-01-2001 02:09 PM
Re: Updating passwords using PAM functions
Hi,
Putpwent function requires a file pointer to that specific file. I want to overwrite the existing password for that user in that file which means I need a pointer to where it exists. Is there another function that will allow me to overwrite a specific user record within a file?
I need to be able to manipulate these files to replace the existing password with the password being sent to me by the other machine when these passwords are different. The 2 functions I am using don't use the nsswitch.conf file. Any solutions?
Putpwent function requires a file pointer to that specific file. I want to overwrite the existing password for that user in that file which means I need a pointer to where it exists. Is there another function that will allow me to overwrite a specific user record within a file?
I need to be able to manipulate these files to replace the existing password with the password being sent to me by the other machine when these passwords are different. The 2 functions I am using don't use the nsswitch.conf file. Any solutions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2001 02:26 PM
05-01-2001 02:26 PM
Re: Updating passwords using PAM functions
You're right Kristin. Putpwent does need a file pointer. I probably don't need to remind you but anytime you are doing this development make sure that you are logged in as root in at least two places with a saved copy of /etc/passwd somewhere - just in case.
Clay
Clay
If it ain't broke, I can fix that.
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.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP