简体   繁体   中英

How to generate .htpasswd keys with php that I could insert into my .htpasswd file on my ubuntu server?

Its quite honestly hard to understand.

I have an ubuntu server with my local webserver which Im "securing" with .htaccess and.htpasswd.

I know that I can just generate it on the mashine itself in bash. But for *hits and giggles I want to try to make a simple webpage that I could manage htpasswd file and create users from the browser itself.

I already tried to $str = md5(_Post("pasw")) But I guess these keys are different. Maybe could someone help me understand how these hashes are created so that I could make this work hehe.

Short ver: How to generate.htpasswd key that I could insert into.htpasswd file in my server so that it would work.

Thank you!

(1) sudo nano /etc/apache2/sites-available/000-default.conf

<Directory /usr/share/phpmyadmin>
    AuthType Basic
    AuthName "Restricted Content"
    AuthUserFile /etc/phpmyadmin/.htpasswd
    Require valid-user
</Directory>

(2) sudo htpasswd -c /etc/phpmyadmin/.htpasswd nageen

for new user: sudo htpasswd /etc/phpmyadmin/.htpasswd localuser

asking for add password, add password for user

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM