Permissions problem with perl script to change users password
Hi all!
I'm writting a script in perl to change users's password from a web browser. I'm using the Unix::PasswdFile module and I'm having a problem with it, when I run the script from the brower I get this error (from apaches's erro.log file): Code:
[Wed Aug 15 13:00:02 2012] [error] [client 192.168.1.2] Can't locate Unix/PasswdFile.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at ./login_chpass.pl line 6., referer: http://192.168.1.50/admon/cambiar_pass/cambiar_pass.html I set www-data as the owner of the file, but It still doesn't work. This is my script: Code:
#login_chpass.pl Then I changed the login_chpass.pl file owner to root and I tried to use something like an "interface" to try to run the script with sudo, but It doesn't work (I modified the sudoers file to grant privileges to the www-data user): Code:
#ch_pass_int.pl I hope you can help me. Thanks a lot!! |
It seems pretty straight-forward to me. When you're running it from the command line, you may have your include path set up so that Unix/PasswdFile.pm can be found on it. But when it's run from the browser (as if logged in as uid www-data, gid www-data), the path doesn't include where you have it installed.
Either you need to reinstall it in a system-visible place (i.e. one of the standard places PERL looks - see the first error line for the list), or you need to add its install location to PERL's search path for when it's invoked through the browser. Hope this helps. |
Hi jonsg, thanks for your answer:
* "you need to add its install location to PERL's search path": How can I do it? I know is needed change some enviroment variables, but I don't know what to modify. * I searched the PasswdFile location and the module is installed in the root directory, I think that is the problem, what do you think? and how can I solved? Code:
# find / -name PasswdFile.pm |
All times are GMT -5. The time now is 05:24 PM. |