imjacobclark/Raspcontrol — pull request #141 by Rauks (2013-08-13 09:48:06+00:00)
Title: Auto password hash for database.aptmnt

See #135

The database file structure is not changed. You still have to create the `/etc/raspcontrol/database.aptmnt` file as the following:

```
{
"user": "yourName",
"password": "yourPassword"
}
```

The file must be owned by www-data with read and write rights:

```
chown www-data:www-data /etc/raspcontrol/database.aptmnt
chmod 740 /etc/raspcontrol/database.aptmnt
```

So only www-data group can read it and only www-data user can read and write into it.

At the first login attempt the password will be auto-hashed and the database file will become:

```
{
"user": "yourName",
"password": "$2y$10$u3r.1juaaW3rH87nI7W6o.HxuhdOj\/gnpM8Ok.mcudnq0bSx\/2PYC"
}
```

The password salt is randomly generated, so you will not have the same hash.

In case of not writable database file for www-data the password will not be hashed but the login will still works.
The password is hashed only if he is not yet hashed.