Created
August 29, 2013 08:22
-
-
Save stigkj/6375538 to your computer and use it in GitHub Desktop.
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 | |
# --- Change domain password ver 0.1 | |
# --- Ideas and comments: [email protected] | |
# --- Looks for the existance of smbpasswd, if it doesnt't exist (aka OS X Lion) | |
# --- it will connect to a linux host and run the command from there. | |
# --- The credentials for the linux box will be hardcoded into this script and | |
# --- the linux host in question should have a restricted shell for security sake. | |
# Command usage | |
USAGE="Usage: `basename $0` username\nExample: `basename $0` jdoe\n\nMake sure your VPN is connected" | |
# Make sure the user provided a username | |
if [[ $# -eq 0 ]]; then | |
echo -e $USAGE >&2 | |
exit 1 | |
fi | |
# look for passwd locally and decide if we can continue here | |
PASSWDPATH=`whereis smbpasswd` | |
if [[ -z "PASSWDPATH" ]]; then | |
echo "smbpasswd found in system, continuing locally -- $PASSWDPATH --" | |
smbpasswd -U <uid> -r <domain controller> | |
else | |
echo "smbpasswd not found, establishing connection with a remote system, $1." | |
ssh -t $1 "smbpasswd -U <uid> -r <domain controller>" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment