Last active
April 18, 2019 13:20
-
-
Save ju916/ce58e0ce5c80030a34154ec48793cdc5 to your computer and use it in GitHub Desktop.
Script to create a user database suitable for pam_userdb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# create a user database suitable for pam_userdb | |
# usage: | |
# mk-pinlist.sh [user] [db file] | |
USR=${1:-`who | grep ':0' | head -1 | awk '{print $1}'`} | |
shift | |
DB=${1:-'/etc/pinlist.db'} | |
HASH=`mkpasswd -s -m sha-512` | |
{ echo $USR; echo $HASH; } | db_load -T -t hash $DB | |
chmod 0600 $DB | |
echo "Current content:" | |
echo "================" | |
db_dump -p $DB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment