RHEL4 vs SELinux

用密码控制访问apache目录

1.线索:cat /var/log/httpd/error_log
2.发现:每次登录加密目录失败后都会在error_log追加如下记录:
   [Sat Jun 18 02:32:16 2005] [error] [client 221.5.200.34]
   MySQL ERROR: Table 'test.user_info' doesn't exist
   (晕:居然跟mysql 有关,各位看官此时是不是有些纳闷?)
3.Google里搜寻:MySQL ERROR: Table 'test.user_info' doesn't exist
4.如下收获:

If you are trying to run mod_auth_mysql and BASIC htaccess authentication at the same time you may want to do something like so in your httpd.conf after you have mod_auth_mysql working.

<Directory />
Options All
AuthMySQLEnable off
AllowOverride All
</Directory>

This will turn it off globally. The main reason for us needing to do this is because if a client uses cpanel to create Password Protected Directories and then tries to access this protected directory you'll get something like:
[Mon May 2 10:29:48 2005] [error] MySQL ERROR: Table 'test.user_info' doesn't exist: /test
[Mon May 2 10:29:48 2005] [error] MySQL user test not found: /test
[Mon May 2 10:29:49 2005] [error] MySQL ERROR: Table 'test.user_info' doesn't exist: /test
[Mon May 2 10:29:49 2005] [error] MySQL user test not found: /test
[Mon May 2 10:29:50 2005] [error] MySQL ERROR: Table 'test.user_info' doesn't exist: /test
[Mon May 2 10:29:50 2005] [error] MySQL user test not found: /test


It automatically tries to use mod_auth_mysql as the only authentication. So turn it off globally and then in your .htaccess file turn it back on per directory as you need it.

And a good how-to on installing mod_auth_mysql with Apache 1.3 (linux) go here:
http://www.webhostgear.com/215.html

Just wanted to share this in case anyone else has run into the same problem.

5.根据该贴修改配置,大功告成,可以成功登录密码限制目录。

Apache上访问控制的问题 RHEL4, 系统自带Apache,  SELinux已关闭
我想将网站的abc目录设置成为需要输入用户名与密码后才能访问。
配置文件如下(所有配置文件的属性已经设为755,属于apache用户),
配置完成后浏览时会显示需要输入用户和密码窗口,但是输入后也无法进入(还是显示请输入密码)。
请高手指点。

-----------------httpd.conf-----------------------
<Directory "/var/www/html/abc">
require user abc
AuthUserFile /home/user
AuthType Basic
AuthName "abc"
</Directory>
-------/home/user--------
abc:KWGk9SqLrFQdA


-------已次输入用户密码后浏览器显示的内容-------

Authorization Required

This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
Apache/2.0.52 (Red Hat) Server at 192.168.1.7 Port 80

1.线索:cat /var/log/httpd/error_log
2.发现:每次登录加密目录失败后都会在error_log追加如下记录:
   [Sat Jun 18 02:32:16 2005] [error] [client 221.5.200.34]
   MySQL ERROR: Table 'test.user_info' doesn't exist
   (晕:居然跟mysql 有关,各位看官此时是不是有些纳闷?)
3.Google里搜寻:MySQL ERROR: Table 'test.user_info' doesn't exist
4.如下收获:

If you are trying to run mod_auth_mysql and BASIC htaccess authentication at the same time you may want to do something like so in your httpd.conf after you have mod_auth_mysql working.

<Directory />
Options All
AuthMySQLEnable off
AllowOverride All
</Directory>

This will turn it off globally. The main reason for us needing to do this is because if a client uses cpanel to create Password Protected Directories and then tries to access this protected directory you'll get something like:
[Mon May 2 10:29:48 2005] [error] MySQL ERROR: Table 'test.user_info' doesn't exist: /test
[Mon May 2 10:29:48 2005] [error] MySQL user test not found: /test
[Mon May 2 10:29:49 2005] [error] MySQL ERROR: Table 'test.user_info' doesn't exist: /test
[Mon May 2 10:29:49 2005] [error] MySQL user test not found: /test
[Mon May 2 10:29:50 2005] [error] MySQL ERROR: Table 'test.user_info' doesn't exist: /test
[Mon May 2 10:29:50 2005] [error] MySQL user test not found: /test


It automatically tries to use mod_auth_mysql as the only authentication. So turn it off globally and then in your .htaccess file turn it back on per directory as you need it.

And a good how-to on installing mod_auth_mysql with Apache 1.3 (linux) go here:
http://www.webhostgear.com/215.html

Just wanted to share this in case anyone else has run into the same problem.

5.根据该贴修改配置,大功告成,可以成功登录密码限制目录。


Apache上访问控制的问题2

1.线索:cat /var/log/httpd/error_log
2.发现:每次登录加密目录失败后都会在error_log追加如下记录:
   [Sat Jun 18 02:32:16 2005] [error] [client 221.5.200.34]
   MySQL ERROR: Table 'test.user_info' doesn't exist
   (晕:居然跟mysql 有关,各位看官此时是不是有些纳闷?)
3.Google里搜寻:MySQL ERROR: Table 'test.user_info' doesn't exist
4.如下收获:

If you are trying to run mod_auth_mysql and BASIC htaccess authentication at the same time you may want to do something like so in your httpd.conf after you have mod_auth_mysql working.

<Directory />
Options All
AuthMySQLEnable off
AllowOverride All
</Directory>

This will turn it off globally. The main reason for us needing to do this is because if a client uses cpanel to create Password Protected Directories and then tries to access this protected directory you'll get something like:
[Mon May 2 10:29:48 2005] [error] MySQL ERROR: Table 'test.user_info' doesn't exist: /test
[Mon May 2 10:29:48 2005] [error] MySQL user test not found: /test
[Mon May 2 10:29:49 2005] [error] MySQL ERROR: Table 'test.user_info' doesn't exist: /test
[Mon May 2 10:29:49 2005] [error] MySQL user test not found: /test
[Mon May 2 10:29:50 2005] [error] MySQL ERROR: Table 'test.user_info' doesn't exist: /test
[Mon May 2 10:29:50 2005] [error] MySQL user test not found: /test


It automatically tries to use mod_auth_mysql as the only authentication. So turn it off globally and then in your .htaccess file turn it back on per directory as you need it.

And a good how-to on installing mod_auth_mysql with Apache 1.3 (linux) go here:
http://www.webhostgear.com/215.html

Just wanted to share this in case anyone else has run into the same problem.

5.根据该贴修改配置,大功告成,可以成功登录密码限制目录。

如何把按中文安装的redhat server4 变回英文环境 LANG=en_US.UTF-8

apache根目录权限问题 httpd.conf中的配置为默认配置
DocumentRoot  "/var/www/html"

下载phpMyAdmin-2.6.4-pl4.tar.gz并解压至目录/usr/local/src,
#cd /usr/local/src
#tar -zxvf phpMyAdmin-2.6.4-pl4.tar.gz
#cp -ar phpMyAdmin-2.6.4-pl4 /var/www/html/phpMyAdmin
#cd /var/www/html
#ll
drwxr-xr-x  7 52400 24067 4096 Nov 15 23:33 phpMyAdmin
#chown -R root:root /var/www/html/phpMyAdmin
#chmod 755 -R /var/www/html/phpMyAdmin
#ll
drwxr-xr-x  7 root root 4096 Nov 15 23:33 phpMyAdmin
然后在浏览器中浏览http://192.168.10.121/phpMyAdmin
报告如下提示:
You don't have permission to access /phpMyAdmin on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.


--------------------------------------------------------------------------------

Apache/2.0.52 (Red Hat) Server at 192.168.10.121 Port 80

问题解决:(因噎废食的解决方法)
diable 掉selinux,selinux是linux下面的安全加强,启用了该功能安全是安全了,可视很多东西一调试就出问题,建议新手还是禁用了吧。

最终解决方法:
#ls -Z
chcon -R -t -h httpd_sys_context_t phpMyAdmin
#ls -Z
对于文件或者目录的contexts不清楚可以查看一下文件:/etc/selinux/targeted/contexts/files的内容

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值