Skip to content

Instantly share code, notes, and snippets.

@dinigo
Created January 12, 2015 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dinigo/310e95a1f7899c9b42f5 to your computer and use it in GitHub Desktop.
Save dinigo/310e95a1f7899c9b42f5 to your computer and use it in GitHub Desktop.
Add a user, with a home directory but without shell access, to the Samba and Time Machine services
#!/bin/sh
# Call this script as root like:
# ./addmediauser.sh myusername mypassword
# Password will be shown in plain text (obviously)
# so watch out for shoulder surfers!
USERNAME=$1
PASSWORD=$2
useradd --create-home --groups samba timemachine --shell /bin/false $USERNAME
echo "$USERNAME:$PASSWORD" | sudo chpasswd
(echo $PASSWORD; echo $PASSWORD) | smbpasswd -as ${USERNAME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment