ºìÁªLinuxÃÅ»§
Linux°ïÖú

ÈÃÄãµÄLinuxÖ§³ÖWEBÐÞ¸ÄÃÜÂë

·¢²¼Ê±¼ä:2006-04-18 01:06:42À´Ô´:ºìÁª×÷Õß:[Hl.y]
ÏÖÔÚʹÓÃLinux×öΪ·þÎñÆ÷Ô½À´Ô½Æձ飬һ¸öÖÐС»ú¹¹²ÉÓÃLinux×öÓʼþ·þÎñÆ÷¡¢WEB·þÎñÆ÷µÈ¶¼Ê®·ÖºÏÊÊ¡£¶øÕâЩ·þÎñµÄÓû§£¨ÈçE-MailÓû§£©³£³£²¢²»ÊÇÊ®·ÖÊìϤµçÄÔ£¬ÐÞ¸Ä×Ô¼ºµÄÃÜÂë±È½Ï·Ñ¾¢¡£ËùÒÔ£¬Èç¹ûÄܹ»Ìṩһ¸ö²Ù×÷·½±ãµÄÐÞ¸ÄÃÜÂëµÄ·½·¨ÊÇÊ®·ÖÓÐÓõġ£ÏÂÃ棬ÎÒÃǾÍÒ»ÆðÀ´ÈÃÄãµÄLinux·þÎñÆ÷Ö§³ÖÓû§Í¨¹ýWEB·½Ê½À´ÐÞ¸ÄÃÜÂë¡£
×ÔÓÉÈí¼þchpasswdÄܹ»Ê¹ÄãÊ®·ÖÇáËɵØÍê³ÉÕâ¸ö¹¦ÄÜÐèÇó¡£

Ò»¡¢ ÏÂÔØÈí¼þ

Õâ¸ö×ÔÓÉÈí¼þÔ´ÓÚ²¨À¼£¬½ØÖ¹µ½±ÊÕßдÕâƪÎÄÕÂʱ£¬×îа汾ÊÇ2.1°æ¡£Äã¿ÉÒÔÔÚhttp://sic.popnet.pl/~mlody/chpasswd/ÏÂÔص½Õâ¸öÈí¼þ¡£
¸ÃÈí¼þÒÑÔÚSlackware 4.0/7.0¡¢Debian GNU/Linux woody¡¢RedHat 6.1/5.2ÖвâÊÔͨ¹ý¡£
Èí¼þÔ´³ÌÐò°üÃû³ÆÊÇ£ºchpasswd.2.1.tar.gz£¬ËüÊÇʹÓÃgzipѹËõ¹ýµÄ£¬Ñ¹Ëõºó´óСΪ83K¡£±ÊÕßÔڴ˼ÙÉèÄ㽫Õâ¸öÈí¼þÏÂÔغ󣬴æ·ÅÔÚ/usr/localĿ¼Ï¡£

¶þ¡¢ °²×°Èí¼þ

Õâ¸öÈí¼þµÄ°²×°Ê®·Ö¼òµ¥£º
1£® ÒÔrootÓû§µÇ¼ϵͳ£»
2£® תµ½/usr/localĿ¼£¬È»ºó½âѹËõÕâ¸öÈí¼þ£º
cd /usr/local
tar -zxvf chpasswd.2.1.tar.gz
³É¹¦Ö´Ðк󣬻áÔÚ/usr/localĿ¼ÏÂÐÂÉú³ÉÒ»¸öchpasswd.2.1Ŀ¼¡£
3£® ½øÈëÈí¼þĿ¼£¬°²×°Èí¼þ£º
cd chpasswd.2.1
./build.sh
Õâʱ½«³öÏÖÒÔÏÂÊä³ö£¨ÖÐÎIJ¿·ÖÊDZÊÕß¼ÓÉÏÈ¥µÄ×¢½â£©£º
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. £¨×¼±¸WEBÒ³ÃæÎļþ£©
Configure script for chpasswd 2.0, make by ml0dy
...finded HTTP daemon (/usr/local/apache/bin/httpd) £¨×Ô¶¯·¢ÏÖHTTP½ø³Ì£©
...COOL, Apache HTTP daemon (ver.1.3.14) £¨·¢ÏÖÊÇApache£©
...configure file: /usr/local/apache/conf/httpd.conf £¨ÅäÖÃÎļþÊÇhttpd.conf£©
...Group = nobody
CGI-BIN directory: /usr/local/apache/cgi-bin £¨ÕÒµ½CGIĿ¼£©
...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 chpasswd.c salt.o pw_encrypt.o md5_cryp£¨ÖÁ´ËÍê³ÉÁ˱àÒë¹ý³Ì£©

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
£¨½«chpasswd.cgi¿½±´µ½ÏàӦĿ¼²¢×öÏàÓ¦µÄȨÏÞÉèÖã©
µ½´ËΪֹ£¬Èí¼þ¾Í°²×°Íê³ÉÁË¡£

Èý¡¢ ʹÓÃWEBÐÞ¸ÄÃÜÂë

Èí¼þ¾Í°²×°Íê³Éºó£¬ÄãÖ»Òª½«chpasswd.cgiÁ´½Óµ½ÄãÖ÷Ò³ÉϾͿÉÒÔÍê³ÉÁË£¬»òÕßÔÚ¿Í»§¶Ëä¯ÀÀÆ÷ÉÏÊäÈëwww.yourdomain.com/cgi-bin/chpasswd.cgi£¬Ä㽫¿´µ½ÒÔϽçÃ棺




ÔÚloginÀ¸ÖÐÊäÈëÄãµÄÓû§Ãû£¬ÔÚcurrent passwdÀ¸ÖÐÊäÈëÄãÔ­À´µÄÃÜÂ룬²¢ÔÚnew passwdºÍnew passwd(confirm)À¸ÖÐÊäÈëÐÂÃÜÂ루עÒ⣬Á½¸öÃÜÂëÐèÒ»Ö£©£¬È»ºó°´ÏÂchange°´Å¥¡£µ±³öÏÖÒÔÏ»­Ã棬¾Í±íʾÐ޸ijɹ¦£º




Èç¹û³öÏÖÁËʲô´íÎó£¬Ôò»á³öÏÖÏàÓ¦µÄÌáʾ£¬ÆäÖаüÀ¨£º
1£© ERROR£ºYou didn't write your login, that's stupid...
ÄãûÓÐÌîдÄãµÄÓû§Ãû£¬Õ汿£¡
2£© ERROR£ºYou didn't write your current password...
ÄãûÓÐÌîдÄãµÄµ±Ç°ÃÜÂ룻
3£© ERROR£ºYour new password and confirmed new password do not match.
ÄãÁ½´ÎÊäÈëµÄÐÂÃÜÂë²»Ò»Ñù£»
4£©ERROR£ºYou can't change password by WWW, contact to your administrator!
Äã²»ÄÜͨ¹ýWEB·½Ê½ÐÞ¸ÄÃÜÂ룬ÇëÓë¹ÜÀíÔ±ÁªÏµ£»
5£©ERROR£ºIncorrect password...
µ±Ç°ÃÜÂë²»¶Ô£¨·ÀÖ¹±ðÈËÖªµÀÓû§ÃûÇé¿öÏÂÐÞ¸ÄÄãÃÜÂ룩
6£©ERROR£ºYou didn't write your new password...
ÄãûÓÐÌîдÄãÐÂÃÜÂ룻
7£©ERROR£ºUnknown user.
Óû§Ãû²»´æÔÚ£¬¹À¼ÆÄãÊä´íÁË£»
8£©ERROR£ºYou didn't write your new password (confirm)...
ÄãûÓÐÊäÈënew password (confirm)¡£
Õâ°ËÖÖ´íÎó¶¼ÓгöÏÖÒ»¸öÀàËÆÓÚÉÏÃæµÄÕâ¸öµÄÍøÒ³£¬¸øÄúÌáʾ¡£

ËÄ¡¢ ʹÓü¼ÇÉ

1. ½ûֹijЩÓû§Í¨¹ýWEB·½Ê½ÐÞ¸ÄÃÜÂ룺
ÓÐЩϵͳÕʺÅÈçroot¡¢ftpµÈÕʺÅÒ»°ãÊDz»ÐèҪͨ¹ýWEB·½Ê½À´Ð޸ĵģ¬ÁíÍ⣬ÓÐʱÄã»á²»ÏëÈÃij¸öÓû§Í¨¹ýWEB·½Ê½ÐÞ¸ÄÃÜÂ룬ÄãÖ»ÐèÐÞ¸ÄÒ»ÏÂÅäÖÃÎļþ¾ÍÐÐÁË¡£
°²×°chpasswdºó£¬»áÉú³ÉÒ»¸ö/etc/www.denyÎļþ£¬ÔÚÕâ¸öÎļþÖÐÁгöµÄÓû§¾ù²»ÄÜͨ¹ýWEB·½Ê½½øÐÐÐÞ¸ÄÃÜÂë¡£ÄãÖ»Ð轫Óû§Ìí¼Ó½øÈ¥¾Í¿ÉÒÔÁË£¬ÂíÉÏÉúЧ¡£

2. ÐÞ¸ÄchpasswdµÄÒ³Ãæ
Èç¹ûÄã¶Ôchpasswd×Ô´øµÄÕâЩҳÃæ²»ÂúÒâµÄ»°£¬Äã¿ÉÒÔ×Ô¼ºÐÞ¸ÄËü¡£

ËüÃÇÔÚ/usr/local/chpasswd.2.1/htmlĿ¼ÖУ¬Õâ¸öĿ¼ÓÐÒÔϼ¸¸öÎļþ£º
index.html£ºÐ޸ĵÄÖ÷½çÃæ
ok.html£ºÐ޸ijɹ¦µÄ½çÃæ
error1.html
error2.html
¡­¡­
error8.html£º¾ÍÊÇÉÏÃæËùÊöµÄ8¸ö´íÎóµÄ½çÃæ¡£
Äã¿ÉÒÔÖ±½ÓÐÞ¸ÄËüÃÇ£¬ÐÞ¸ÄÍê³Éºóºóתµ½/usr/local/chpasswd.2.1Ŀ¼Ï£¬Ö´ÐÐ./create-html.shÃüÁȻºóÔÙÖ´ÐÐ./bulid.shÍê³É°²×°¡£
ÁíÍâÇë×¢Ò⣺ÔÚÓÐЩϵͳÖÐΪÁË×·Çó¸ü´óµÄ°²È«ÐÔ£¬Á¬rootÓû§¶¼Ã»¶Ô/etc/shadowдµÄȨÏÞ£¬ÕâÑù»á³öÏÖһЩÎÊÌâ¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. sonwfly ÓÚ 2006-07-29 16:44:28·¢±í:

    Ö§³ÖÏÂ