.htpasswd

How can I get a user's input when using htaccess/htpasswd?

橙三吉。 提交于 2019-12-30 05:27:09
问题 I want to create a log in system using htaccess and htpasswd file and PHP for the server-side code, but when the user logs in I want to be able to identify that user, so how can I know what the user typed in as their username using PHP code (I assume I won't need to know the password if they've managed to access the restricted page)? Many thanks, Ben 回答1: You just need the following to get the username that is currently in use for an authenticated session: $_SERVER['PHP_AUTH_USER'] rev1 In

Angular: how to add a unique .htaccess file per configuration?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 02:19:48
问题 My Angular app contains 2 build configurations: staging, and production. Currently I have a standard .htaccess file for all builds, by including it in my assets: "assets": [ "src/.htaccess", "src/assets", "src/favicon.png" ], I want to password protect my staging build directory with a .htpasswd file, so I updated my assets to include it: "assets": [ "src/.htaccess", "src/.htpasswd" "src/assets", "src/favicon.png" ], The htpasswd file can be included in every build, because without a mention

How to set up htaccess and htpasswd in my private server?

£可爱£侵袭症+ 提交于 2019-12-24 07:38:11
问题 At the moment I'm trying set up authentication on my test server. The following is the list of files in the folder I'm trying to set up authentication for. sftp://it@192.168.0.157/var/www/secret/.htpasswd sftp://it@192.168.0.157/var/www/secret/.htaccess sftp://it@192.168.0.157/var/www/secret/index.html Here's what .htaccess contains: AuthName "Restricted Area" AuthType Basic AuthUserFile /secret/.htpasswd AuthGroupFile /dev/null <Files test.html> require valid-user </Files> I'm not getting

Domain specific htpasswd conditions

半城伤御伤魂 提交于 2019-12-22 08:59:15
问题 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. 回答1: You can use SetEnvIf, here's a snippet from this post by Tom Schlick. #allows a single

Apache htpasswd secure password change

…衆ロ難τιáo~ 提交于 2019-12-21 09:22:17
问题 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". 回答1: 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

Nginx sucessfully password protects PHP files, but then prompts you to download them

三世轮回 提交于 2019-12-20 03:18:21
问题 In a previous question, I was trying to password protect my /admin/ and sub-folders directory using Nginx with .htpasswd and regex. That was done successfully, but now, after password authentication was completed, Nginx prompts to "download" php files, rather than simply loading them. This doesn't happen when the new location "authentication" block is commented out. For instance, in this code sample, PHP pages load without any issue: location / { try_files $uri $uri/ =404; } #location "~^

How do I figure out what user & group Apache is running as?

早过忘川 提交于 2019-12-19 07:50:59
问题 On DreamHost shared hosting, I'm setting up htpasswd, but Apache does not have permission to read the file. How do I give it permission? I want to either change the owner or group of the .htpasswd file instead of giving it insecure permissions. I don't think I have access to the httpd.conf file, so I can't use this method to find what user Apache runs as. Also, running top or ps aux only shows the processes I'm running but doesn't show the apache process. Based on the output from cat /etc

How do I figure out what user & group Apache is running as?

纵饮孤独 提交于 2019-12-19 07:50:03
问题 On DreamHost shared hosting, I'm setting up htpasswd, but Apache does not have permission to read the file. How do I give it permission? I want to either change the owner or group of the .htpasswd file instead of giving it insecure permissions. I don't think I have access to the httpd.conf file, so I can't use this method to find what user Apache runs as. Also, running top or ps aux only shows the processes I'm running but doesn't show the apache process. Based on the output from cat /etc

Cakephp Password Protection with htaccess and htpasswd - howto?

♀尐吖头ヾ 提交于 2019-12-19 02:46:07
问题 How can I password protect my website during development with htaccess in Cakephp? which htaccess file do I have to change? what do I have to write in the htaccess where do I put the .htpasswd? I searched google for that but couldn't find anything useful, I hope you could help me! Thanks Till that helped me solve the problem! For CakePHP-Users: - Modify the .htaccess in /app/webroot/ - add something like that at the beginning of the .htaccess-file: AuthName "Restricted Area" AuthType Basic

How to write “if…else” mod_rewrite statements in .htaccess

断了今生、忘了曾经 提交于 2019-12-18 08:58:20
问题 I've scoured StackOverflow for an answer to this and seen many questions come close, but nothing is working for me yet. I'd like to have my .htaccess apply different rules based on the domain calling it. Basically, if subdomain.example.com is hit, redirect to google.com. If localhost is hit, redirect to yahoo.com. If www.example.com (or example.com) is hit, redirect to bing.com. I'll be adding in actual rewrite rules (setting environment variables and htpasswd protection) later, but first I