.htpasswd

Create new HTTP auth credentials using PHP instead of shell

邮差的信 提交于 2019-12-10 16:54:43
问题 I know that it's possible to add new HTTP auth credentials through this shell script: htpasswd -c .htpasswd testing Is it possible to achieve the same with a PHP script? I know I could use a regular PHP auth system, but that's not what I'm looking for. 回答1: You can execute this command with system or exec to add your users. I've created a code snippet that might work for you: <?php define('HTPASSFILEPATH', '.htpasswd'); function addUser($pUser, $pPass) { exec("htpasswd -cb " . HTPASSFILEPATH

Password Protecting Web Directories and Files

泄露秘密 提交于 2019-12-08 13:44:33
问题 A user enters my website and arrives at the home page, he/she should always and only be at home page. All other files are scripts that are run by the homepage but the user should never navigate to them. So here's my directory layout: They will arrive at Front.php and should always stay at Front. So I created an htaccess file that has this code: DirectoryIndex Front.php index.html AuthType Basic AuthName "Login" AuthUserFile /disks/*/*/*/.htpasswd Require valid-user Right now, EVERYTHING

htaccess and htpasswd?

家住魔仙堡 提交于 2019-12-08 06:37:50
问题 My first time using htaccess to ask for a user password. on my server .htpasswd file lies in my root directory of my server. .htaccess file lies in folder folder "uploads" (which lies in the root dir) i used … <?php echo dirname(__FILE__); ?> to get the full server path to my root dir. my .htaccess file in my "uploads" folder looks like this now: AuthType Basic AuthName "Uploads to my website" AuthUserFile /home/.sites/74/site484/web .htpasswd Require valid-user and my .htpasswd file in the

Password protecting files in a folder in Nginx using .htpasswd

╄→гoц情女王★ 提交于 2019-12-08 03:27:57
问题 I'm trying to use .htpasswd to protect an /admin/ section on my domain. I'm able to successfully protect the root index.php file using this config: location /admin/ { try_files $uri $uri/ =404; auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.htpasswd; } But the associated files within that folder are still viewable. For instance, on http://domain.com/admin/whatever.php -- the page loads, then the Nginx password auth comes up, but you can simply cancel out of it and still view the

.htaccess password protected folder goes to 404 page

假装没事ソ 提交于 2019-12-07 05:09:41
问题 I've stumbled upon a strange issue. Lets say I have folder in main domain directory: /myfolder When I try to access index of files in this folder I go to: myurl.com/myfolder And it works without any problems. Now when I put .htaccess with password protection in this folder like: AuthUserFile /home/mywebsite/.htpasssomerandomname AuthType Basic AuthName "Authentication Required" Require valid-user Suddenly instead of asking me for password when I try to access myurl.com/myfolder I get 404

Password protecting files in a folder in Nginx using .htpasswd

ⅰ亾dé卋堺 提交于 2019-12-06 15:05:23
I'm trying to use .htpasswd to protect an /admin/ section on my domain. I'm able to successfully protect the root index.php file using this config: location /admin/ { try_files $uri $uri/ =404; auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.htpasswd; } But the associated files within that folder are still viewable. For instance, on http://domain.com/admin/whatever.php -- the page loads, then the Nginx password auth comes up, but you can simply cancel out of it and still view the page. After doing some research, I've tried to use regex wildcards unsuccessfully. Doesn't work: location

Domain specific htpasswd conditions

我是研究僧i 提交于 2019-12-05 18:06:09
I am using a wildcard dns system that routes all subdomains through a single web app and sets a userid based on the first part of the URL (X.domain.com where X is the username). I now want to edit my htaccess file to enable conditional httpauth using htpasswd for specific domains. e.g. if url = password.domain.com the enable httpauth. I'm sure this is possible but have limited knowledge of htaccess. Gnurou You can use SetEnvIf , here's a snippet from this post by Tom Schlick. #allows a single uri through the .htaccess password protection SetEnvIf Request_URI "/testing_uri$" test_uri #allows

.htaccess password protected folder goes to 404 page

半城伤御伤魂 提交于 2019-12-05 08:59:38
I've stumbled upon a strange issue. Lets say I have folder in main domain directory: /myfolder When I try to access index of files in this folder I go to: myurl.com/myfolder And it works without any problems. Now when I put .htaccess with password protection in this folder like: AuthUserFile /home/mywebsite/.htpasssomerandomname AuthType Basic AuthName "Authentication Required" Require valid-user Suddenly instead of asking me for password when I try to access myurl.com/myfolder I get 404 wordpress template page. Below is my .htaccess in main WordPress folder. <IfModule mod_rewrite.c>

Apache htpasswd secure password change

守給你的承諾、 提交于 2019-12-04 03:31:25
My question is simple. How to allow users to change their passwords stored in some htpasswd file in linux without revealing the files content or allow users to modify other passwords? I tried to write a script to do that job using ssh and specialy-designed user but it leads noway. Please help. I am using Debian server "Lenny". The Apache htpasswd file does not support any shadow functionality. Therefor you have to prevent the users accessing your web server in order to keep them away from the password file. So the only solution is your SSH based approach or any other remote solution. The

how to generate a hash like apache's htpasswd using java

送分小仙女□ 提交于 2019-12-04 03:24:57
问题 i use "Force MD5 encryption of the password" in htpasswd to generate a hash for instance '123' i get: use htpasswd: 123 => $apr1$kaTbKaLO$ewJXRZAKpjaxK4thy2jOp/ use MD5 digest: 123 => 202cb962ac59075b964b07152d234b70 please tell me how can i generate a hash like the apache htpasswd using java Thanks. 回答1: Passwords in Apache .htpasswd files are encoded using a salt. If you want to generate these passwords using Java you'll need to do the same. This site has an explanation of the salt/hashing