HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: api's in php/perl which would change passwd of...
Operating System - HP-UX
1833869
Members
1627
Online
110063
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
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
09-13-2001 07:47 AM
09-13-2001 07:47 AM
api's in php/perl which would change passwd of user
Hi,
Are there api's in php/perl which would change
the /etc/passwd of user. This user log's in on
the web page. The web page has login and passwd and ability to change the passwd as well.
And authentication has to be only on /etc/passwd file.
The requirement is strictly on php and perl, no C programs which uses api's like getpwent/putpwent.
Any help on this will be appreciated.
Any sample code/site,etc.
Thanks and Regards
Deepak
Are there api's in php/perl which would change
the /etc/passwd of user. This user log's in on
the web page. The web page has login and passwd and ability to change the passwd as well.
And authentication has to be only on /etc/passwd file.
The requirement is strictly on php and perl, no C programs which uses api's like getpwent/putpwent.
Any help on this will be appreciated.
Any sample code/site,etc.
Thanks and Regards
Deepak
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2001 04:26 PM
09-13-2001 04:26 PM
Re: api's in php/perl which would change passwd of user
Deepak,
I have not performed the exact task you're
asking about, but here are some items you
may find useful.
You've probably noticed already that perl
provides a set of functions such as
getpwent/setpwent
Assuming you're using a recent version of perl5, check out
perldoc -f getpwent
or
perldoc -f setpwent
for a list.
There are also perl5 modules at CPAN related to
the passwd file:
http://search.cpan.org/search?mode=module&query=passwd
Depending upon your setup and the required level
of security, you might want to consider the following:
http://httpd.apache.org/docs/misc/FAQ-G.html#passwdauth
before mixing unix and web based password authentication.
One other note -- webmin is a web based program
that can update/modify /etc/passwd and might
either perform the function for you or show you
how yourself:
http://www.webmin.com/webmin
From the Webmin README:
"Webmin Version 0.84
-------------------
Webmin is a web-based interface for
system administration for Unix. Using
any browser that supports tables and
forms, you can setup user accounts,
Apache, internet services, DNS, file
sharing and so on.
Webmin consists of a simple web server,
and a number of CGI programs which
directly update system files like
/etc/inetd.conf and /etc/passwd. The
web server and all CGI programs are
written in Perl version 5, and use only
the standard perl modules."
You can get an apache with webmin from
http://www.hp.com/products1/unix/webservers/apache/downloads/index.html
Hope that helps,
Bryan
I have not performed the exact task you're
asking about, but here are some items you
may find useful.
You've probably noticed already that perl
provides a set of functions such as
getpwent/setpwent
Assuming you're using a recent version of perl5, check out
perldoc -f getpwent
or
perldoc -f setpwent
for a list.
There are also perl5 modules at CPAN related to
the passwd file:
http://search.cpan.org/search?mode=module&query=passwd
Depending upon your setup and the required level
of security, you might want to consider the following:
http://httpd.apache.org/docs/misc/FAQ-G.html#passwdauth
before mixing unix and web based password authentication.
One other note -- webmin is a web based program
that can update/modify /etc/passwd and might
either perform the function for you or show you
how yourself:
http://www.webmin.com/webmin
From the Webmin README:
"Webmin Version 0.84
-------------------
Webmin is a web-based interface for
system administration for Unix. Using
any browser that supports tables and
forms, you can setup user accounts,
Apache, internet services, DNS, file
sharing and so on.
Webmin consists of a simple web server,
and a number of CGI programs which
directly update system files like
/etc/inetd.conf and /etc/passwd. The
web server and all CGI programs are
written in Perl version 5, and use only
the standard perl modules."
You can get an apache with webmin from
http://www.hp.com/products1/unix/webservers/apache/downloads/index.html
Hope that helps,
Bryan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2001 05:55 PM
09-13-2001 05:55 PM
Re: api's in php/perl which would change passwd of user
Hi:
Unfortunately, Perl's getpwent() function knows nothing about the pw_age field. If you need to worry about passwd aging and minimum time before a user can change his passwd or those which can only be changed by root, Perl's functions won't do the job. You would be better off to create your own routines. Fortunately, you do have perl's crypt function which will test the old passwd and create a new passwd for you. You need to grab the first 2 chars or the old passwd as 'salt' to supply to the crypt function. You will also need to create a random 2-char salt value based upon the character set ./[0-9][A-Z][a-z] when you call crypt for creating the new passwd hash.
Everything you need is actually in place crypt(), srand(),rand(),int() to do the passwd hashing. If you want to do this in an NIS environment or a trusted environment, things get more complicated. I suggest you look at www.perl.org/CPAN and search for passwd. You will find quite a few modules.
Regards, Clay
Unfortunately, Perl's getpwent() function knows nothing about the pw_age field. If you need to worry about passwd aging and minimum time before a user can change his passwd or those which can only be changed by root, Perl's functions won't do the job. You would be better off to create your own routines. Fortunately, you do have perl's crypt function which will test the old passwd and create a new passwd for you. You need to grab the first 2 chars or the old passwd as 'salt' to supply to the crypt function. You will also need to create a random 2-char salt value based upon the character set ./[0-9][A-Z][a-z] when you call crypt for creating the new passwd hash.
Everything you need is actually in place crypt(), srand(),rand(),int() to do the passwd hashing. If you want to do this in an NIS environment or a trusted environment, things get more complicated. I suggest you look at www.perl.org/CPAN and search for passwd. You will find quite a few modules.
Regards, 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