Ochrana webového adresáře heslem
Z Centrum Informatiky
Do chráněného adresáře uložit soubor .htaccess
AuthUserFile SYS:/cesta/.jmeno_souboru AuthType Basic AuthName "Vyzva k autentikaci" require valid-user
V prvním řádku je absolutní cesta k souboru obsahujícímu uživatele a hesla. Ten se vytvoří pomocí utility htpasswd.exe
Syntaxe:
htpasswd -c .jmeno_souboru uzivatel
Přepínač c - vytvoření nového souboru
Vytvoření nového souboru .jmeno_souboru s uživatelem admin
htpasswd -c .jmeno_souboru admin Automatically using MD5 format on Windows. New password: ************ Re-type new password: ************ Adding password for user admin
Změna hesla uživatele admin
htpasswd .jmeno_souboru admin Automatically using MD5 format on Windows. New password: ************ Re-type new password: ************ Updating password for user admin
Přidání uživatele jirka
htpasswd .jmeno_souboru jirka Automatically using MD5 format on Windows. New password: ********** Re-type new password: ********** Adding password for user jirka
Kompletní nápověda k htpasswd.exe
Pozn. pro Apache na NW používat MD5 (defaultní) hashování.
Usage:
htpasswd [-cmdps] passwordfile username
htpasswd -b[cmdps] passwordfile username password
htpasswd -n[mdps] username
htpasswd -nb[mdps] username password
-c Create a new file.
-n Don't update file; display results on stdout.
-m Force MD5 encryption of the password (default).
-d Force CRYPT encryption of the password.
-p Do not encrypt the password (plaintext).
-s Force SHA encryption of the password.
-b Use the password from the command line rather than prompting for it.
On Windows, TPF and NetWare systems the '-m' flag is used by default.
On all other systems, the '-p' flag will probably not work.