Saturday, March 18, 2017

Bash Scripting: Add User Accounts

#!/bin/bash
#
######################################################
# Add User Accounts
######################################################
#
# Variables
user_file=/home/kensipe/sbin/data.d/user_list
temp_passwd="$( openssl passwd -crypt )"
#
# Read User List File
#

echo "Temp Password is: $temp_passwd"
echo

exec < $user_file

while IFS=','  read user name
do
        useradd -c "$name" -m -p "$temp_user" $user
        echo "$user $name"
done
#
tail /etc/passwd

#Note:
#####  user_file=/home/kensipe/sbin/data.d/user_list
#
#[kensipe@localhost data.d]$ cat user_list
#jpaul,John Paul
#bfranklin,Ben Franklin
#gwashington,George Washington
#prevere,Paul Revere

No comments:

Post a Comment