#!/bin/bash
# Add an account to Linux and add to samba automagically
# Created to speed up user creation on an Ubuntu Server,
# but could be used on any Linux platform for the same thing.
# 2013-01-19 07:33:38+00:00 category5.tv

sudo echo Enter super-user password...
clear

echo 
echo Add a user to the server
echo
read -p "Username: "
 USERNAME="$REPLY"
read -p "Password: "
 PASSWORD="$REPLY"
echo
echo Adding user $USERNAME
 sudo useradd $USERNAME
echo Done.
echo
echo Setting password for $USERNAME
 (echo $PASSWORD; echo $PASSWORD ) | sudo passwd $USERNAME
echo
echo Adding $USERNAME to samba
 (echo $PASSWORD; echo $PASSWORD ) | sudo smbpasswd -s -a $USERNAME
echo
echo All done adding $USERNAME


syntax highlighted by Code2HTML, v. 0.9.1