2014-06-10 11 views

cevap

18

Bu

username:$apr1$sr15veBe$cwxJZHTVLHBkZKUoTHV.k. 

$ apr1 $ gibi görünen bir dosya oluşturur şifre olarak

htpasswd -c /usr/local/apache/passwd/passwords username 

aşağıdaki komutu ve "parolam" kullanarak şifre oluşturmak varsayarsak karma yöntemidir , sr15veBe tuz ve son dize karma şifre. Sen çıkış

$apr1$sr15veBe$cwxJZHTVLHBkZKUoTHV.k. 

Kullanmak verebilecek bir boru hattı olacağını olacaktır

openssl passwd -apr1 -salt sr15veBe myPassword 

kullanarak openssl kullanarak doğrulayabilir:

username="something" 
htpasswd -c /usr/local/apache/passwd/passwords $username 
****Enter password:**** 

salt=$($(cat passwords | cut -d$ -f3) 
password=$(openssl passwd -apr1 -salt $salt) 
****Enter password:**** 

grep -q $username:$password passwords 
if [ $? -eq 0 ] 
then echo "password is valid" 
else 
echo "password is invalid" 
fi 
Sen openssl komutu değiştirmeniz gerekebilir

olarak Apache'nin htpasswd komutu her sistemde biraz farklıdır. Daha fazla bilgi için

, Bunun için htpasswd aracı kullanabilirsiniz http://httpd.apache.org/docs/2.2/misc/password_encryptions.html

5

de konu üzerine Apache sayfasını ziyaret edin.

# 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. 

Çık durum başarısızlık başarı için 0, 3 olduğunu.

İlgili konular