| Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
07-08-2009, 12:11 AM
|
#1
|
|
Member
Registered: Jun 2009
Location: India
Distribution: All flavours of linux
Posts: 93
Rep:
|
Resetting user passwords through php web page
Hi All Linux Experts
We are using LDAP for user authentication & I have set a policy that the password expires after 45 days.
But when the password expires users have to request me to set up & now the problem is all the users want a Web page through which they can change or reset their passwords.
I have discovered "expect" tool which can run in background for resetting LDAP passwords but I know very little about PHP so please help me to make a secure front end in PHP.
Thanks in Advance
Sushant Chawla
Linux Administrator
|
|
|
|
07-08-2009, 01:43 AM
|
#2
|
|
Member
Registered: Mar 2007
Posts: 100
Rep:
|
Design a form that will submit the username value using get or post method.
Get that username and set the password using system() function in php.
Make sure the script doesnt set root password inadvertently. Also parse the username input so that no other system command is executed.
This would be enough to deploy in secured private network.....
|
|
|
|
07-08-2009, 02:04 AM
|
#3
|
|
Member
Registered: Jun 2009
Location: India
Distribution: All flavours of linux
Posts: 93
Original Poster
Rep:
|
Quote:
Originally Posted by suhas!
Design a form that will submit the username value using get or post method.
Get that username and set the password using system() function in php.
Make sure the script doesnt set root password inadvertently. Also parse the username input so that no other system command is executed.
This would be enough to deploy in secured private network.....
|
Hi Suhas
Firstly thanks for the reply. Please tell me how to use system function & currently i am issuing the command like this in action.php page
`sudo /changepasswd $username $password`
but it is saying you must have tty to set the password. The webserver user is apache & I have given apache user sudo access to run this script.
Secondly when I run this script manually from apache user sudo -u apache /changepasswd it is saying only root user can set the user password.
|
|
|
|
07-09-2009, 12:57 AM
|
#4
|
|
Guru
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.4, Centos 5.9
Posts: 15,021
|
Quote:
|
sudo -u apache /changepasswd
|
that's telling it to run the cmd as apache, which is the very thing you don't want.
When you call sudo, it knows who you are calling it as ....
|
|
|
|
07-09-2009, 02:02 AM
|
#5
|
|
Member
Registered: Jun 2009
Location: India
Distribution: All flavours of linux
Posts: 93
Original Poster
Rep:
|
Quote:
Originally Posted by chrism01
that's telling it to run the cmd as apache, which is the very thing you don't want.
When you call sudo, it knows who you are calling it as ....
|
No I want the apache user to run this command & i have given it the permissions in sudo too. If the apache user can't run this command then how can we change password from web page?
|
|
|
|
07-09-2009, 03:46 PM
|
#6
|
|
LQ Newbie
Registered: Jul 2009
Location: Atlantic, IA, USA
Distribution: Debian and Mint
Posts: 12
Rep:
|
sushantchawla2005,
Have you ever looked at webmin?
http://www.webmin.com.
Shawn
Last edited by apt-shawn; 07-09-2009 at 03:55 PM.
|
|
|
|
07-09-2009, 11:19 PM
|
#7
|
|
Member
Registered: Jun 2009
Location: India
Distribution: All flavours of linux
Posts: 93
Original Poster
Rep:
|
Yes I am using webmin but I want that every body can reset his/her password but giving the access through webmin will disclose many other configurations of my servers to everybody.
Isn't it?
|
|
|
|
07-10-2009, 01:16 AM
|
#8
|
|
Member
Registered: Mar 2007
Posts: 100
Rep:
|
Hi sushant,
instead of doing following thing in bash prompt --
sudo -u apache /changepasswd username password
Do this thing --
su -l apache -c sudo /changepasswd username password
That will actually test if apache user can sudo or not....
|
|
|
|
07-10-2009, 03:13 AM
|
#9
|
|
Member
Registered: Jun 2009
Location: India
Distribution: All flavours of linux
Posts: 93
Original Poster
Rep:
|
Suhas
Its running but giving the error
passwd: only root can specify a user name
I have given the following entry in sudoers
apache ALL=(ALL) NOPASSWD: ALL
Please helppp
|
|
|
|
07-10-2009, 08:22 AM
|
#10
|
|
Member
Registered: Mar 2007
Posts: 100
Rep:
|
* Comment out following line in visudo
#Defaults requiretty
* Allow Apache user to execute command via sudo in visudo
apache ALL=(ALL) NOPASSWD: ALL
* Execute following command
[root@www ~]# su -l apache -s /bin/bash -c "sudo passwd suhas"
Changing password for user suhas.
New UNIX password:
Later you can tighten the security by allowing only passwd command to apache user
Regards,
Last edited by suhas!; 07-10-2009 at 08:24 AM.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:47 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|