Created
January 12, 2015 19:05
-
-
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
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/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