Deploy with stow

This commit is contained in:
2025-06-12 00:31:22 -04:00
parent 9c0ade560c
commit 5e80dc91b1
29 changed files with 149 additions and 44 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