.htpasswd
How to automate generation of htpasswd from command line without typing password?
Why not just use: htpasswd -b -c ~/temp/password admin test101
Verify user and password against a file created by htpasswd
You can use the htpasswd tool for this. # create htpasswd_file with user:password $ htpasswd -cb htpasswd_file user password Adding password for user user # verify password for user $ htpasswd -vb htpasswd_file user wrongpassword password verification failed $ htpasswd -vb htpasswd_file user password Password for user user correct. Exit status is 0 for success, … Read more
How to use a RELATIVE path with AuthUserFile in htaccess?
It is not possible to use relative paths for AuthUserFile: File-path is the path to the user file. If it is not absolute (i.e., if it doesn’t begin with a slash), it is treated as relative to the ServerRoot. You have to accept and work around that limitation. We’re using IfDefine together with an apache2 … Read more
Adding a user on .htpasswd
Exact same thing, just omit the -c option. Apache’s docs on it here. htpasswd /etc/apache2/.htpasswd newuser Also, htpasswd typically isn’t run as root. It’s typically owned by either the web server, or the owner of the files being served. If you’re using root to edit it instead of logging in as one of those users, … Read more