Allow your Linux to Support WEB Password Modification

Source: Internet
Author: User
Let your Linux support changing the WEB Password-Linux Enterprise Application-Linux server application information. The following is a detailed description. Nowadays, Linux is becoming more and more common as a server. It is very suitable for medium and small organizations to use Linux as an email server or WEB server. Users of these services (such as E-Mail users) are often not very familiar with computers and it is difficult to modify their own passwords. Therefore, it is very useful to provide a convenient password change method. Next, let's let your Linux server support users to change their passwords through WEB.
The Free Software chpasswd allows you to easily fulfill this functional requirement.

1. Download Software

This free software originated from Poland. By the time I wrote this article, the latest version was version 2.1. You can in http://sic.popnet.pl /~ Mlody/chpasswd/download to this software.
The software has been tested and passed in Slackware 4.0/7.0, Debian GNU/Linux woody, RedHat 6.1/5.2.
The name of the software source package is chpasswd.2.1.tar.gz, Which is compressed by gzip and is 83 K in size. I assume that you have downloaded the software and stored it in the/usr/local directory.

Ii. Install software

The installation of this software is very simple:
1. log on to the system as a root user;
2. Go to the/usr/local directory and decompress the software:
Cd/usr/local
Tar-zxvf chpasswd.2.1.tar.gz
After the chpasswd.2.1 directory is created in the/usr/local directory.
3. Go to the Software Directory and install the software:
Cd chpasswd.2.1
./Build. sh
The following output will appear (the Chinese part is the annotation added by the author ):
Create-html.sh for chpasswd 2.0, make by ml0dy
Conwerting... 'error1' file
Conwerting... 'error2 'file
Conwerting... 'error3 'file
Conwerting... 'error4' file
Conwerting... 'error5' file
Conwerting... 'error6' file
Conwerting... 'error7' file
Conwerting... 'error8' file
Conwerting... 'index' file
Conwerting... 'OK' file
Done. (prepare WEB page files)
Configure script for chpasswd 2.0, make by ml0dy
... Finded HTTP daemon (/usr/local/apache/bin/httpd) (automatically discovers HTTP processes)
... COOL, Apache HTTP daemon (ver.1.3.14) (Apache)
... Configure file:/usr/local/apache/conf/httpd. conf (the configuration file is httpd. conf)
... Group = nobody
CGI-BIN directory:/usr/local/apache/cgi-bin (find CGI directory)
... Correcting Makefile
Gcc-DHAVE_CONFIG_H-I.-O2-Wall-c libs/commonio. c-o libs/commonio. o
Gcc-DHAVE_CONFIG_H-I.-O2-Wall-c libs/commonio. c-o libs/commonio. o
Gcc-DHAVE_CONFIG_H-I.-O2-Wall-c libs/pwio. c-o libs/pwio. o
Gcc-DHAVE_CONFIG_H-I.-O2-Wall-c libs/shadowio. c-o libs/shadowio. o
Gcc-DHAVE_CONFIG_H-I.-O2-Wall-c libs/sgetpwent. c-o libs/sgetpwent. o
Gcc-Wall-O2-c salt. c
Gcc-Wall-O2-c pw_encrypt.c
Gcc-Wall-O2-c md5_crypt.c
Gcc-Wall-O2-c des_crypt.c
Gcc-Wall-O2-c cgilib. c
Gcc-Wall-O2-c mgets. c
Gcc-Wall-O2-DHAVE_SHADOW-o chpasswd. c salt. o pw_encrypt.o md5_cryp (the compilation process has been completed)

Cp chpasswd/usr/local/apache/cgi-bin/chpasswd. cgi
Chown root/usr/local/apache/cgi-bin/chpasswd. cgi
Chgrp nobody/usr/local/apache/cgi-bin/chpasswd. cgi
Chmod u + s/usr/local/apache/cgi-bin/chpasswd. cgi
Chmod a-rx/usr/local/apache/cgi-bin/chpasswd. cgi
Chmod g + rx/usr/local/apache/cgi-bin/chpasswd. cgi
(Copy chpasswd. cgi to the corresponding directory and set the permission accordingly)
So far, the software has been installed.

3. Use the WEB to change the password

After the software is installed, you only need to link chpasswd. cgi to your home page, or enter www.yourdomain.com/cgi-bin/chpasswd.cgion the client browser. You will see the following:




(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.linuxeden.com/edu/eduimg/000003/chpasswd01.jpg'); ">

Enter your username in the login column, enter your original password in the current passwd column, and enter the new password in the new passwd and new passwd (confirm) columns (note, the two passwords must be consistent), and then press the change button. If the following screen appears, the modification is successful:




(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.linuxeden.com/edu/eduimg/000003/chpasswd02.jpg'); ">

If an error occurs, a prompt is displayed, including:
1) ERROR: You didn't write your login, that's stupid...
You didn't enter your username. It's really stupid!
2) ERROR: You didn't write your current password...
You did not enter your current password;
3) ERROR: Your new password and confirmed new password do not match.
The new password you entered twice is different;
4) ERROR: You can't change password by WWW, contact to your administrator!
You cannot change the password on the WEB. Contact the administrator;
5) ERROR: Incorrect password...
The current password is incorrect (to prevent others from modifying your password when they know the user name)
6) ERROR: You didn't write your new password...
You did not enter your new password;
7) ERROR: Unknown user.
The user name does not exist. It is estimated that you have entered an error;
8) ERROR: You didn't write your new password (confirm )...
You did not enter new password (confirm ).
All these eight errors have a webpage similar to the preceding one, and you will be prompted.

Iv. Tips

1. Disable some users from modifying their passwords on the WEB:
Some system accounts such as root and ftp do not need to be modified on the WEB. In addition, sometimes you do not want a user to modify the password on the WEB, you only need to modify the configuration file.
After chpasswd is installed, a/etc/www. deny file is generated. Users listed in this file cannot modify the password on the WEB. You only need to add the user to it and it will take effect immediately.

2. Modify the chpasswd page
If you are not satisfied with the pages provided by chpasswd, you can modify them by yourself.

They are in the/usr/local/chpasswd.2.1/html Directory, which contains the following files:
Index.html: the modified Main Interface
OK .html: Modified Interface
Error1.html
Error2.html
......
Error8.html: the eight error interfaces described above.
You can modify them directly, and then go to the/usr/local/chpasswd.2.1 directory to execute the./create-html.sh command. Then execute./bulid. sh to complete the installation.
In addition, please note: In some systems, for greater security, even root users do not have the write permission on/etc/shadow, which may cause some problems.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.