We help IT Professionals succeed at work.

I want to change a Linux passowrd programatically!

profya
profya asked
on
Medium Priority
239 Views
Last Modified: 2010-04-21
I have an e-mail server thatuses Linux 7.1 database users as its e-mail users. I wanna allow my e-mail users to change their passwords in both Linux and of course the e-mail server. I need a way to write code in Perl, PHP or any other server side scripting language that supported by Apache. I prefer a function that takes for example the old password and the new one as parameters. I'll be very thankful if one helped me to get that.
Comment
Watch Question

Commented:
In general, to change passwords from scripts, I recommend "expect". It requires tcl to be installed.

Assuming that you are not using md5 passwords, you may just want to change the password directly in the /etc/shadow file (danger! will robinson). In which case you can generate the new 'encrypted' password using 'perl -e "print crypt('changeme','XX');"'.

K.
jmcgOwner
CERTIFIED EXPERT

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: kyrmit {http:#6570775}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
Forced accept.

Yensidmod
EE Moderator

Explore More ContentExplore courses, solutions, and other research materials related to this topic.