Update scripts and deploy with gnu stow

This commit is contained in:
2025-06-11 20:56:19 -04:00
parent f66c7a03c2
commit 537f23077e
37 changed files with 903 additions and 677 deletions

View File

@@ -0,0 +1,44 @@
#!/usr/bin/env bash
# Reset a user password on the server
# Copyright 2021-2025 Bryan C. Roessler
# Licensed under the Apache License, Version 2.0
p="${BASH_SOURCE[0]%/*}"; [[ -r $p/script-functions ]] && . "$p"/script-functions || exit 1
is_root
echo "Usage: $0 [username] [password]"
case $# in
0)
prompt user
prompt password
;;
1)
user="$1"
prompt password
;;
2)
user="$1"
password="$2"
;;
*)
echo "Too many arguments provided"
exit 1
;;
esac
if ! id -u "$user" &>/dev/null; then
echo "User $user does not exist"
exit 1
fi
if ask_ok "Change user $user's password to $password?"; then
echo "$user:$password" | chpasswd
(echo "$password"; echo "$password") | smbpasswd -a -s "$user"
fi
ask_ok "Prompt user to reset password on next login?" &&
passwd --expire "$user" &&
echo "NOTE: The file sharing (smbpasswd) will not be changed"
exit 0