In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Apache MySQL based authentication [@more@] This article describes how to implement user authentication in Apache, discusses how to save authentication information in MySQL database, and then implements authentication through mod_auth_mysql module. I. Overview The previous section discussed the use of databases in authentication, specifically the mod_auth_db module and the use of DB files. Here is how to use the very popular MySQL database to store authentication information and then access the MySQL database through mod_auth_mysql for authentication. 1.1 about MySQL MySQL is an excellent database server with small size and fast speed. MySQL is released under the GPL and its home page is at http://www.mysql.com/. MySQL lacks some of the features provided by expensive large databases, such as stored procedures, triggers, etc., but it has the basic features needed for most small and medium-sized projects. In addition, it has some very useful features, such as regular expressions that can be used with SQL commands. Because MySQL is free and performs so well, it is a popular database on UNIX family operating systems--especially for users on a limited budget. Also note that MySQL also has a version that runs on Windows. 1.2 About mod_auth_mysql module We can use mod_auth_mysql module to save user names and passwords to MySQL database and then use them directly for authentication. There are many other benefits to using this approach in addition to faster data access. For example, assuming that user information is stored in a database, password verification using text files requires a duplicate of the user name and password, so you have to maintain the same data in two places. If the two data are not updated simultaneously, the user may not be able to log in. Conversely, if mod_auth_mysql is used, we can authenticate directly with the user information in the database. In this case, only one copy of the user information is enough, and the user name and password can be updated with SQL commands. There will be no problems that may be encountered when using text files. It's also easy to change the groups to which users belong. II. Installation and configuration To obtain mod_auth_mysql module or view its details, visit http://bourbon.netvision.net.il/mod_auth_mysql/. mod_auth_mysql can be compiled into a DSO (Dynamic Shared Object) and installed on the server simply by configuration instructions. For more information on DSO, see Apache Guide: A Must for Novice Installations. When configuring mod_auth_mysql, we must tell it which database to use for authentication, which tables, and what fields contain information for authentication. Here are the configuration directives you must know to configure mod_auth_mysql: Auth_MySQL_Info [host] [user] [password] This directive states which server the database runs on and the user name and password that should be used to access the database. We only need to use this directive if the database is not running on localhost or if the database is accessed by someone other than httpd. If all authentication operations use the same database, you can use the following command: Auth_MySQL_General_DB [database name] Otherwise, if you use different databases for authentication operations in different directories, you can ignore this directive and specify the database to use in each directory. The following instructions apply to both the httpd.conf configuration file and the. httaccess files for individual directories. See Using .htaccess Files with Apache for more information. Note that you can apply commonly used directives when password protecting a directory, as follows: AuthType BasicAuthName "Members Only"require group adminAuth_MySQL_DB [database name]: Declares which database information to use for authentication. Auth_MySQL_Password_Table: Declares which table in the database contains password information. Unless otherwise stated, the default field containing the user name is "username" and the field containing the password is "password." But we can specify additional fields as described below. Auth_MySQL_Group_Table: Generally, we can save the information of the group to which the user belongs (groups field) and the user name and password in the same table. But if it is necessary to save it to a separate table, you can specify the name of the table here. Auth_MySQL_Username_Field: If the field holding the user name information is not "username," you can specify the field name actually used with this directive. Auth_MySQL_Password_Field: If the password field is not "password," you can use this directive to specify the actual field name used. Auth_MySQL_Group_Field: If the field holding group information is not "groups," you can specify the actual field name used with this directive. Auth_MySQL_Encrypted_Passwords on/off: Tells mod_auth_mysql whether passwords stored in the database are encrypted. The default is on, which assumes that passwords stored in the database are encrypted. There are other commands, but these are the ones that are often used. Auth_MySQL_Info localhost db_user db_passwordAuth_MySQL_DB authenticationAuth_Mysql_Password_Table passwordsAuthType BasicAuthName "Members Only"require valid-user The above example assumes that the field holding the user name is username and the password is encrypted and stored in the password field. III. OTHER Once the.htaccess file is set up as described above, the password entry window appears when you visit the page below that directory. For users, there is no difference between different password protection implementations. You can use any database management tool you are familiar with to manage user information. There seems to be no simple tool like dbmmanage to manage user information from the command line. But we can manipulate databases with Perl and DBI. The next article will discuss the many advantages of using Perl to manage password files. There are so many ways to manage passwords in Perl that it would be appropriate to document them separately. Conclusion: Using mod_auth_mysql, we can save user names, passwords, and group information to MySQL databases. MySQL is a small, fast, free database server that is available on most popular operating systems.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.